1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
/* Copyright (c) 2008-2022 the MRtrix3 contributors.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Covered Software is provided under this License on an "as is"
* basis, without warranty of any kind, either expressed, implied, or
* statutory, including, without limitation, warranties that the
* Covered Software is free of defects, merchantable, fit for a
* particular purpose or non-infringing.
* See the Mozilla Public License v. 2.0 for more details.
*
* For more details, see http://www.mrtrix.org/.
*/
#include <cctype>
#include "header.h"
#include "file/ofstream.h"
#include "file/mgh.h"
namespace MR
{
namespace File
{
namespace MGH
{
std::string tag_ID_to_string (const int32_t tag)
{
switch (tag) {
case MGH_TAG_OLD_COLORTABLE: return "MGH_TAG_OLD_COLORTABLE";
case MGH_TAG_OLD_USEREALRAS: return "MGH_TAG_OLD_USEREALRAS";
case MGH_TAG_CMDLINE: return "MGH_TAG_CMDLINE";
case MGH_TAG_USEREALRAS: return "MGH_TAG_USEREALRAS";
case MGH_TAG_COLORTABLE: return "MGH_TAG_COLORTABLE";
case MGH_TAG_GCAMORPH_GEOM: return "MGH_TAG_GCAMORPH_GEOM";
case MGH_TAG_GCAMORPH_TYPE: return "MGH_TAG_GCAMORPH_TYPE";
case MGH_TAG_GCAMORPH_LABELS: return "MGH_TAG_GCAMORPH_LABELS";
case MGH_TAG_OLD_SURF_GEOM: return "MGH_TAG_OLD_SURF_GEOM";
case MGH_TAG_SURF_GEOM: return "MGH_TAG_SURF_GEOM";
case MGH_TAG_OLD_MGH_XFORM: return "MGH_TAG_OLD_MGH_XFORM";
case MGH_TAG_MGH_XFORM: return "MGH_TAG_MGH_XFORM";
case MGH_TAG_GROUP_AVG_SURFACE_AREA: return "MGH_TAG_GROUP_AVG_SURFACE_AREA";
case MGH_TAG_AUTO_ALIGN: return "MGH_TAG_AUTO_ALIGN";
case MGH_TAG_SCALAR_DOUBLE: return "MGH_TAG_SCALAR_DOUBLE";
case MGH_TAG_PEDIR: return "MGH_TAG_PEDIR";
case MGH_TAG_MRI_FRAME: return "MGH_TAG_MRI_FRAME";
case MGH_TAG_FIELDSTRENGTH: return "MGH_TAG_FIELDSTRENGTH";
default: break;
}
return "MGH_TAG_" + str(tag);
}
int32_t string_to_tag_ID (const std::string& key)
{
if (key.compare (0, 8, "MGH_TAG_") == 0) {
auto id = key.substr (8);
if (id == "OLD_COLORTABLE") return MGH_TAG_OLD_COLORTABLE;
if (id == "OLD_USEREALRAS") return MGH_TAG_OLD_USEREALRAS;
if (id == "CMDLINE") return MGH_TAG_CMDLINE;
if (id == "USEREALRAS") return MGH_TAG_USEREALRAS;
if (id == "COLORTABLE") return MGH_TAG_COLORTABLE;
if (id == "GCAMORPH_GEOM") return MGH_TAG_GCAMORPH_GEOM;
if (id == "GCAMORPH_TYPE") return MGH_TAG_GCAMORPH_TYPE;
if (id == "GCAMORPH_LABELS") return MGH_TAG_GCAMORPH_LABELS;
if (id == "OLD_SURF_GEOM") return MGH_TAG_OLD_SURF_GEOM;
if (id == "SURF_GEOM") return MGH_TAG_SURF_GEOM;
if (id == "OLD_MGH_XFORM") return MGH_TAG_OLD_MGH_XFORM;
if (id == "MGH_XFORM") return MGH_TAG_MGH_XFORM;
if (id == "GROUP_AVG_SURFACE_AREA") return MGH_TAG_GROUP_AVG_SURFACE_AREA;
if (id == "AUTO_ALIGN") return MGH_TAG_AUTO_ALIGN;
if (id == "SCALAR_DOUBLE") return MGH_TAG_SCALAR_DOUBLE;
if (id == "PEDIR") return MGH_TAG_PEDIR;
if (id == "MRI_FRAME") return MGH_TAG_MRI_FRAME;
if (id == "FIELDSTRENGTH") return MGH_TAG_FIELDSTRENGTH;
}
return 0;
}
}
}
}
|