26 CPPUNIT_TEST_SUITE(mitkDICOMTagPathTestSuite);
37 CPPUNIT_TEST_SUITE_END();
60 deepPath_withAnyElement.
AddElement(0x0010, 0x0011);
62 deepPath_withAnyElement.
AddElement(0x003a, 0x003f);
64 deepPath_withAnySelection.
AddElement(0x0010, 0x0011);
66 deepPath_withAnySelection.
AddElement(0x0030, 0x0033);
68 deepPath_withSelection.
AddElement(0x0010, 0x0011);
70 deepPath_withSelection.
AddElement(0x003b, 0x003e);
79 void tearDown()
override
86 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyRegEx() with '(0010,0011)'", std::string(
"DICOM\\.0010\\.0011"), result);
88 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyRegEx() with '(0010,0011).(0020,0022).(003A,0033)'", std::string(
"DICOM\\.0010\\.0011\\.0020\\.0022\\.(003a|003A)\\.0033"), result);
90 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyRegEx() with '(0010,0011).*.(003a,003f)'", std::string(
"DICOM\\.0010\\.0011\\.([A-Fa-f\\d]{4})\\.([A-Fa-f\\d]{4})\\.(003a|003A)\\.(003f|003F)"), result);
92 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyRegEx() with '(0010,0011).(002B,002E)[*].(0030,0033)'", std::string(
"DICOM\\.0010\\.0011\\.(002b|002B)\\.(002e|002E)\\.\\[(\\d*)\\]\\.0030\\.0033"), result);
94 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyRegEx() with '(0010,0011).(0020,0022)[6].(003b,003e)'", std::string(
"DICOM\\.0010\\.0011\\.0020\\.0022\\.\\[6\\]\\.(003b|003B)\\.(003e|003E)"), result);
96 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyRegEx() with '(0010,0011)[*].*.(0030,0033).(004c,004d)[4].(0050,0055)'", std::string(
"DICOM\\.0010\\.0011\\.\\[(\\d*)\\]\\.([A-Fa-f\\d]{4})\\.([A-Fa-f\\d]{4})\\.0030\\.0033\\.(004c|004C)\\.(004d|004D)\\.\\[4\\]\\.0050\\.0055"), result);
102 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyRegEx() with '(0010,0011)'", std::string(
"DICOM_0010_0011"), result);
104 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyRegEx() with '(0010,0011).(0020,0022).(003A,0033)'", std::string(
"DICOM_0010_0011_0020_0022_(003a|003A)_0033"), result);
106 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyRegEx() with '(0010,0011).*.(003a,003f)'", std::string(
"DICOM_0010_0011_([A-Fa-f\\d]{4})_([A-Fa-f\\d]{4})_(003a|003A)_(003f|003F)"), result);
108 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyRegEx() with '(0010,0011).(002B,002E)[*].(0030,0033)'", std::string(
"DICOM_0010_0011_(002b|002B)_(002e|002E)_\\[(\\d*)\\]_0030_0033"), result);
110 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyRegEx() with '(0010,0011).(0020,0022)[6].(003b,003e)'", std::string(
"DICOM_0010_0011_0020_0022_\\[6\\]_(003b|003B)_(003e|003E)"), result);
112 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyRegEx() with '(0010,0011)[*].*.(0030,0033).(004c,004d)[4].(0050,0055)'", std::string(
"DICOM_0010_0011_\\[(\\d*)\\]_([A-Fa-f\\d]{4})_([A-Fa-f\\d]{4})_0030_0033_(004c|004C)_(004d|004D)_\\[4\\]_0050_0055"), result);
118 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyTemplate() with '(0010,0011)'", std::string(
"DICOM_0010_0011"), result);
120 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyTemplate() with '(0010,0011).(0020,0022).(003A,0033)'", std::string(
"DICOM_0010_0011_0020_0022_003A_0033"), result);
122 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyTemplate() with '(0010,0011).*.(003a,003f)'", std::string(
"DICOM_0010_0011_$1_$2_003A_003F"), result);
124 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyTemplate() with '(0010,0011).(002B,002E)[*].(0030,0033)'", std::string(
"DICOM_0010_0011_002B_002E_[$1]_0030_0033"), result);
126 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyTemplate() with '(0010,0011).(0020,0022)[6].(003b,003e)'", std::string(
"DICOM_0010_0011_0020_0022_[6]_003B_003E"), result);
128 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceKeyTemplate() with '(0010,0011)[*].*.(0030,0033).(004c,004d)[4].(0050,0055)'", std::string(
"DICOM_0010_0011_[$1]_$2_$3_0030_0033_004C_004D_[4]_0050_0055"), result);
134 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceNameTemplate() with '(0010,0011)'", std::string(
"DICOM.0010.0011"), result);
136 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceNameTemplate() with '(0010,0011).(0020,0022).(003A,0033)'", std::string(
"DICOM.0010.0011.0020.0022.003A.0033"), result);
138 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceNameTemplate() with '(0010,0011).*.(003a,003f)'", std::string(
"DICOM.0010.0011.$1.$2.003A.003F"), result);
140 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceNameTemplate() with '(0010,0011).(002B,002E)[*].(0030,0033)'", std::string(
"DICOM.0010.0011.002B.002E.[$1].0030.0033"), result);
142 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceNameTemplate() with '(0010,0011).(0020,0022)[6].(003b,003e)'", std::string(
"DICOM.0010.0011.0020.0022.[6].003B.003E"), result);
144 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPersistenceNameTemplate() with '(0010,0011)[*].*.(0030,0033).(004c,004d)[4].(0050,0055)'", std::string(
"DICOM.0010.0011.[$1].$2.$3.0030.0033.004C.004D.[4].0050.0055"), result);
150 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToDCMTKSearchPath() with '(0010,0011)'", std::string(
"(0010,0011)"), result);
152 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToDCMTKSearchPath() with '(0010,0011).(0020,0022).(003A,0033)'", std::string(
"(0010,0011).(0020,0022).(003A,0033)"), result);
155 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToDCMTKSearchPath() with '(0010,0011).(002B,002E)[*].(0030,0033)'", std::string(
"(0010,0011).(002B,002E)[*].(0030,0033)"), result);
157 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToDCMTKSearchPath() with '(0010,0011).(0020,0022)[6].(003b,003e)'", std::string(
"(0010,0011).(0020,0022)[6].(003B,003E)"), result);
164 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing PropertyNameToDICOMTagPath() with '(0010,0011)'", simplePath, result);
166 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing PropertyNameToDICOMTagPath() with '(0010,0011).(0020,0022).(003A,0033)'", deepPath, result);
168 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing PropertyNameToDICOMTagPath() with '(0010,0011).*.(003a,003f)'", deepPath_withAnyElement, result);
170 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing PropertyNameToDICOMTagPath() with '(0010,0011).(002B,002E)[*].(0030,0033)'", deepPath_withAnySelection, result);
172 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing PropertyNameToDICOMTagPath() with '(0010,0011).(0020,0022)[6].(003b,003e)'", deepPath_withSelection, result);
174 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing PropertyNameToDICOMTagPath() with '(0010,0011)[*].*.(0030,0033).(004c,004d)[4].(0050,0055)'", verydeepPath, result);
177 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing PropertyNameToDICOMTagPath() with wrong path", emptyPath, result);
183 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyName() with '(0010,0011)'", result, std::string(
"DICOM.0010.0011"));
185 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyName() with '(0010,0011).(0020,0022).(003A,0033)'", result, std::string(
"DICOM.0010.0011.0020.0022.003A.0033"));
187 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyName() with '(0010,0011).*.(003a,003f)'", result, std::string(
"DICOM.0010.0011.*.003A.003F"));
189 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyName() with '(0010,0011).(002B,002E)[*].(0030,0033)'", result, std::string(
"DICOM.0010.0011.002B.002E.[*].0030.0033"));
191 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyName() with '(0010,0011).(0020,0022)[6].(003b,003e)'", result, std::string(
"DICOM.0010.0011.0020.0022.[6].003B.003E"));
193 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Testing DICOMTagPathToPropertyName() with '(0010,0011)[*].*.(0030,0033).(004c,004d)[4].(0050,0055)'", result, std::string(
"DICOM.0010.0011.[*].*.0030.0033.004C.004D.[4].0050.0055"));
196 void ExecutePropertyRegEx()
200 CPPUNIT_ASSERT(std::regex_match(result, regEx));
203 CPPUNIT_ASSERT(std::regex_match(result, regEx));
206 int position = result.find(
"*");
207 if (std::string::npos != position)
209 result.replace(position, 1,
"1234.ABCD");
210 CPPUNIT_ASSERT(std::regex_match(result, regEx));
214 position = result.find(
"[*]");
215 if (std::string::npos != position)
217 result.replace(position, 3,
"[10]");
218 CPPUNIT_ASSERT(std::regex_match(result, regEx));
222 CPPUNIT_ASSERT(std::regex_match(result, regEx));
225 position = result.find(
"[*]");
226 if (std::string::npos != position)
228 result.replace(position, 3,
"[1]");
229 position = result.find(
"*");
230 if (std::string::npos != position)
232 result.replace(position, 1,
"abcd.1234");
233 CPPUNIT_ASSERT(std::regex_match(result, regEx));
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)
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPersistenceKeyRegEx(const DICOMTagPath &tagPath)
DICOMTagPath & AddAnyElement()
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPersistenceNameTemplate(const DICOMTagPath &tagPath)
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.
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPersistenceKeyTemplate(const DICOMTagPath &tagPath)
MITKDICOMREADER_EXPORT std::string DICOMTagPathToPropertyRegEx(const DICOMTagPath &tagPath)
DICOMTagPath & AddSelection(unsigned int group, unsigned int element, ItemSelectionIndex index)
MITKDICOMREADER_EXPORT std::string DICOMTagPathToDCMTKSearchPath(const DICOMTagPath &tagPath)
MITKDICOMREADER_EXPORT DICOMTagPath PropertyNameToDICOMTagPath(const std::string &propertyName)