17 #ifndef mitkBValueMapPropertySerializer_h_included
18 #define mitkBValueMapPropertySerializer_h_included
35 void split(
const std::string &s,
char delim, std::vector<unsigned int> &elems) {
36 std::stringstream ss(s);
38 while (std::getline(ss, item, delim)) {
39 elems.push_back(std::atoi(item.c_str()));
43 std::vector<unsigned int>
split(
const std::string &s,
char delim) {
44 std::vector<unsigned int> elems;
45 split(s, delim, elems);
51 mitkClassMacro( BValueMapPropertySerializer, BasePropertySerializer )
52 itkFactorylessNewMacro(Self)
55 virtual TiXmlElement* Serialize()
override
57 if (
const BValueMapProperty* prop = dynamic_cast<const BValueMapProperty*>(m_Property.GetPointer()))
62 if(map.empty())
return nullptr;
64 BValueMapProperty::BValueMap::const_iterator it = map.begin();
65 BValueMapProperty::BValueMap::const_iterator end = map.end();
67 auto element =
new TiXmlElement(
"bvaluemap");
72 auto child =
new TiXmlElement(
"entry");
76 child->SetAttribute(
"key", ss.str());
81 for(
unsigned int i = 0 ; i < it->second.size(); i++)
84 ss << it->second[i] <<
",";
86 child->SetAttribute(
"value", ss.str());
88 element->InsertEndChild(*child);
100 if (!element)
return nullptr;
104 TiXmlElement* entry = element->FirstChildElement(
"entry" )->ToElement();
105 while(entry !=
nullptr){
107 std::string key, value;
108 entry->QueryStringAttribute(
"key",&key);
109 entry->QueryStringAttribute(
"value",&value);
111 std::vector<unsigned int> indices =
split(value.c_str(),
',');
113 map[std::atoi(key.c_str())] = indices;
114 entry = entry->NextSiblingElement(
"entry" );
122 BValueMapPropertySerializer(){}
123 virtual ~BValueMapPropertySerializer() {}
#define MITK_REGISTER_SERIALIZER(classname)
std::map< unsigned int, std::vector< unsigned int > > BValueMap
The BValueMap contains seperated IndicesVectors for each b value (index for GradientDirectionContaine...
DataCollection - Class to facilitate loading/accessing structured data.
itk::SmartPointer< Self > Pointer
#define MITKDIFFUSIONCORE_EXPORT
#define mitkClassMacro(className, SuperClassName)
MITKMATCHPOINTREGISTRATION_EXPORT ResultImageType::Pointer map(const InputImageType *input, const RegistrationType *registration, bool throwOnOutOfInputAreaError=false, const double &paddingValue=0, const ResultImageGeometryType *resultGeometry=NULL, bool throwOnMappingError=true, const double &errorValue=0, mitk::ImageMappingInterpolator::Type interpolatorType=mitk::ImageMappingInterpolator::Linear)
static std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.