CiftiLib
A C++ library for CIFTI-2 and CIFTI-1 files
CiftiScalarsMap.h
1#ifndef __CIFTI_SCALARS_MAP_H__
2#define __CIFTI_SCALARS_MAP_H__
3
4/*LICENSE_START*/
5/*
6 * Copyright (c) 2014, Washington University School of Medicine
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include "CiftiMappingType.h"
32
33#include "MetaData.h"
34
35#include <map>
36#include <vector>
37
38namespace cifti
39{
41 {
42 public:
43 CiftiScalarsMap() { }
44 CiftiScalarsMap(const CiftiScalarsMap& rhs) { m_maps = rhs.m_maps; }
45 CiftiScalarsMap& operator=(const CiftiScalarsMap& rhs) { m_maps = rhs.m_maps; return *this; }
46 explicit CiftiScalarsMap(const int64_t& length) { setLength(length); }
47
48 const MetaData& getMapMetadata(const int64_t& index) const;
49 const AString& getMapName(const int64_t& index) const;
50
51 void setMapMetadata(const int64_t& index, const MetaData& mdIn);
52 void setMapName(const int64_t& index, const AString& mapName);
53 void setLength(const int64_t& length);
54 void clear();
55
56 CiftiMappingType* clone() const { return new CiftiScalarsMap(*this); }
57 MappingType getType() const { return SCALARS; }
58 int64_t getLength() const { return m_maps.size(); }
59 bool operator==(const CiftiMappingType& rhs) const;
60 bool approximateMatch(const CiftiMappingType& rhs, AString* explanation = NULL) const;
61 void readXML1(XmlReader& xml);
62 void readXML2(XmlReader& xml);
63 void writeXML1(XmlWriter& xml) const;
64 void writeXML2(XmlWriter& xml) const;
65 private:
66 struct ScalarMap
67 {
68 AString m_name;
69 MetaData m_metaData;
70 bool operator==(const ScalarMap& rhs) const;
71 void readXML1(XmlReader& xml);
72 void readXML2(XmlReader& xml);
73 };
74 std::vector<ScalarMap> m_maps;
75 };
76}
77
78#endif //__CIFTI_SCALARS_MAP_H__
Definition CiftiMappingType.h:39
Definition CiftiScalarsMap.h:41
Definition MetaData.h:44
namespace for all CiftiLib functionality
Definition CiftiBrainModelsMap.h:42