21 CPPUNIT_TEST_SUITE(mitkDICOMPropertyTestSuite);
27 CPPUNIT_TEST_SUITE_END();
43 std::string simplePathStr;
44 std::string deepPathStr;
45 std::string deepPath2Str;
46 std::string deepPath_withSelectionStr;
72 data->GetPropertyList()->SetStringProperty(simplePathStr.c_str(),
"simplePath");
73 data->GetPropertyList()->SetStringProperty(deepPathStr.c_str(),
"deepPath");
74 data->GetPropertyList()->SetStringProperty(deepPath2Str.c_str(),
"deepPath2");
75 data->GetPropertyList()->SetStringProperty(deepPath_withSelectionStr.c_str(),
"deepPath_withSelection");
76 data->GetPropertyList()->SetStringProperty(
"DICOM.0003.0003",
"otherPath");
77 data->GetPropertyList()->SetStringProperty(
"not_a_dicom_prop",
"not_a_dicom_prop");
80 void tearDown()
override 87 CPPUNIT_ASSERT(result.size() == 1);
88 CPPUNIT_ASSERT_EQUAL(result.begin()->second->GetValueAsString(), std::string(
"simplePath"));
91 CPPUNIT_ASSERT(result.size() == 1);
92 CPPUNIT_ASSERT_EQUAL(result.begin()->second->GetValueAsString(), std::string(
"deepPath"));
95 CPPUNIT_ASSERT(result.size() == 1);
96 CPPUNIT_ASSERT_EQUAL(result.begin()->second->GetValueAsString(), std::string(
"deepPath2"));
99 CPPUNIT_ASSERT(result.size() == 3);
100 CPPUNIT_ASSERT_EQUAL(result[deepPathStr]->GetValueAsString(), std::string(
"deepPath"));
101 CPPUNIT_ASSERT_EQUAL(result[deepPath2Str]->GetValueAsString(), std::string(
"deepPath2"));
102 CPPUNIT_ASSERT_EQUAL(result[deepPath_withSelectionStr]->GetValueAsString(), std::string(
"deepPath_withSelection"));
105 CPPUNIT_ASSERT(result.size() == 1);
106 CPPUNIT_ASSERT_EQUAL(result[deepPath_withSelectionStr]->GetValueAsString(), std::string(
"deepPath_withSelection"));
109 CPPUNIT_ASSERT(result.size() == 0);
112 CPPUNIT_ASSERT(result.size() == 0);
116 void GetPropertyByDICOMTagPath_2()
119 CPPUNIT_ASSERT(result.size() == 1);
120 CPPUNIT_ASSERT_EQUAL(result.begin()->second->GetValueAsString(), std::string(
"simplePath"));
123 CPPUNIT_ASSERT(result.size() == 1);
124 CPPUNIT_ASSERT_EQUAL(result.begin()->second->GetValueAsString(), std::string(
"deepPath"));
127 CPPUNIT_ASSERT(result.size() == 1);
128 CPPUNIT_ASSERT_EQUAL(result.begin()->second->GetValueAsString(), std::string(
"deepPath2"));
131 CPPUNIT_ASSERT(result.size() == 3);
132 CPPUNIT_ASSERT_EQUAL(result[deepPathStr]->GetValueAsString(), std::string(
"deepPath"));
133 CPPUNIT_ASSERT_EQUAL(result[deepPath2Str]->GetValueAsString(), std::string(
"deepPath2"));
134 CPPUNIT_ASSERT_EQUAL(result[deepPath_withSelectionStr]->GetValueAsString(), std::string(
"deepPath_withSelection"));
137 CPPUNIT_ASSERT(result.size() == 1);
138 CPPUNIT_ASSERT_EQUAL(result[deepPath_withSelectionStr]->GetValueAsString(), std::string(
"deepPath_withSelection"));
141 CPPUNIT_ASSERT(result.size() == 0);
144 CPPUNIT_ASSERT(result.size() == 0);
149 CPPUNIT_ASSERT_EQUAL(mitk::ConvertDICOMStrToValue<double>(
"1.35"), 1.35);
150 CPPUNIT_ASSERT_EQUAL(mitk::ConvertDICOMStrToValue<double>(
"1"), 1.);
151 CPPUNIT_ASSERT_THROW(mitk::ConvertDICOMStrToValue<int>(
"1.35"),
mitk::Exception);
152 CPPUNIT_ASSERT_EQUAL(mitk::ConvertDICOMStrToValue<int>(
"1"), 1);
153 CPPUNIT_ASSERT_THROW(mitk::ConvertDICOMStrToValue<double>(
"1,35"),
mitk::Exception);
154 CPPUNIT_ASSERT_THROW(mitk::ConvertDICOMStrToValue<double>(
"nonumber"),
mitk::Exception);
DICOMTagPath & AddElement(unsigned int group, unsigned int element)
DICOMTagPath & AddAnySelection(unsigned int group, unsigned int element)
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag...
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
DICOMTagPath & AddAnyElement()
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPropertyName(const DICOMTagPath &tagPath)
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
Test fixture for parameterized tests.
DICOMTagPath & AddSelection(unsigned int group, unsigned int element, ItemSelectionIndex index)
TNumericReturnType ConvertDICOMStrToValue(const std::string &dcmValueString)
MITKDICOMREADER_EXPORT std::map< std::string, BaseProperty::Pointer > GetPropertyByDICOMTagPath(const PropertyList *list, const DICOMTagPath &path)