7 #include "fwTest/DicomReaderTest.hpp" 9 #include <fwData/Image.hpp> 11 #include <fwMedData/Equipment.hpp> 12 #include <fwMedData/ImageSeries.hpp> 13 #include <fwMedData/Patient.hpp> 14 #include <fwMedData/Series.hpp> 15 #include <fwMedData/SeriesDB.hpp> 16 #include <fwMedData/Study.hpp> 18 #include <fwTools/dateAndTime.hpp> 19 #include <fwTools/Type.hpp> 25 #define CHECK_VALUE(check, message, val1, val2) \ 27 check &= (val1 == val2); \ 28 OSLM_ERROR_IF(message << " <"<< val1 << "> != <" << val2 << ">", val1 != val2 ); \ 33 #define CHECK_VALUE_WITH_TOLERANCE(check, message, val1, val2, tol) \ 35 check &= ( val1 - tol <= val2 && val2 <= val1 + tol ); \ 36 OSLM_ERROR_IF(message << val1 << " != " << val2, val1 - tol > val2 || val2 > val1 + tol ); \ 44 bool notReallyChecked =
true;
46 ::fwMedData::Patient::sptr patient = series->getPatient();
47 ::fwMedData::Study::sptr study = series->getStudy();
48 ::fwMedData::Equipment::sptr equipment = series->getEquipment();
51 ::fwData::Image::sptr img = series->getImage();
74 CHECK_VALUE(ok,
"Study Date doesn't match : ",
"20081028", study->getDate());
76 CHECK_VALUE(ok,
"Series Modality doesn't match : ",
"20081028", series->getDate() );
80 CHECK_VALUE(ok,
"Study Time doesn't match : ",
"174327.000", study->getTime() );
82 CHECK_VALUE(ok,
"Series Modality doesn't match : ",
"180156.734", series->getTime() );
87 CHECK_VALUE(ok,
"Series Modality doesn't match : ",
"CT", series->getModality() );
90 CHECK_VALUE(ok,
"Equipment's Institution Name doesn't match : ",
"SCANNER DE LA MODER ",
91 equipment->getInstitutionName() );
93 CHECK_VALUE(ok,
"Study Referring Physician's Name doesn't match : ",
"DR MOREL",
94 study->getReferringPhysicianName() );
97 CHECK_VALUE(ok,
"Study Description doesn't match : ",
" OS 0.5 ", series->getDescription() );
98 CHECK_VALUE(ok,
"Study Description doesn't match : ",
"", study->getDescription() );
101 fwMedData::DicomValuesType physiciansName;
102 ok &= (physiciansName == series->getPerformingPhysiciansName());
103 OSLM_ERROR_IF(
"Name of the physician(s) administering the Series doesn't match : ",
104 (physiciansName == series->getPerformingPhysiciansName()));
109 CHECK_VALUE(ok,
"Patient's Name doesn't match : ",
"CHARNOZ ARNAUD", patient->getName() );
111 CHECK_VALUE(ok,
"Patient ID doesn't match : ",
"12592 ARTHRO GENOU G ", patient->getPatientId() );
113 CHECK_VALUE(ok,
"Patient's Birth Date doesn't match : ",
"19790618", patient->getBirthdate() );
115 CHECK_VALUE(ok,
"Patient's Sex doesn't match :",
"M ", patient->getSex() );
117 CHECK_VALUE(ok,
"Study Patient's Age doesn't match :",
"029Y", study->getPatientAge() );
142 CHECK_VALUE(ok,
"Study Instance UID doesn't match :",
"1.2.392.200036.9116.2.6.1.48.1211418863.1225183167.375775",
143 study->getInstanceUID() );
145 CHECK_VALUE(ok,
"Series Instance UID doesn't match :",
"1.2.392.200036.9116.2.6.1.48.1211418863.1225184516.765855",
146 series->getInstanceUID() );
160 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image x origin doesn't match :", -36.71875, img->getOrigin()[0], 0.01);
161 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image y origin doesn't match :", -88.28125, img->getOrigin()[1], 0.01);
162 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image z origin doesn't match :", 1350.300, img->getOrigin()[2], 0.01);
172 CHECK_VALUE(ok,
"Image x size doesn't match :", 512, img->getSize()[0] );
173 CHECK_VALUE(ok,
"Image y size doesn't match :", 512, img->getSize()[1] );
174 CHECK_VALUE(ok,
"Image z size doesn't match :", 404, img->getSize()[2] );
176 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image x spacing doesn't match :", 0.384, img->getSpacing()[0], 0.001);
177 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image y spacing doesn't match :", 0.384, img->getSpacing()[1], 0.001);
178 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image z spacing doesn't match :", 0.399, img->getSpacing()[2], 0.001);
181 CHECK_VALUE(notReallyChecked,
"Image Bits Allocated correspond :", 16, img->getType().sizeOf() * 8 );
184 CHECK_VALUE(notReallyChecked,
"Image Bits Allocated correspond :",
false, img->getType().isSigned() );
186 CHECK_VALUE(ok,
"Image Window Center correspond :", 500, img->getWindowCenter() );
188 CHECK_VALUE(ok,
"Image Window Width correspond :", 2500, img->getWindowWidth() );
238 bool notReallyChecked =
true;
240 ::fwMedData::Patient::sptr patient = series->getPatient();
241 ::fwMedData::Study::sptr study = series->getStudy();
242 ::fwMedData::Equipment::sptr equipment = series->getEquipment();
245 ::fwData::Image::sptr img = series->getImage();
268 CHECK_VALUE(ok,
"Study Date doesn't match : ",
"20081028", study->getDate());
270 CHECK_VALUE(ok,
"Series Modality doesn't match : ",
"20081028", series->getDate() );
274 CHECK_VALUE(ok,
"Study Time doesn't match : ",
"174327.000", study->getTime() );
276 CHECK_VALUE(ok,
"Series Modality doesn't match : ",
"180156.734", series->getTime() );
281 CHECK_VALUE(ok,
"Series Modality doesn't match : ",
"CT", series->getModality() );
284 CHECK_VALUE(ok,
"Equipment's Institution Name doesn't match : ",
"SCANNER DE LA MODER",
285 equipment->getInstitutionName() );
287 CHECK_VALUE(ok,
"Study Referring Physician's Name doesn't match : ",
"DR MOREL",
288 study->getReferringPhysicianName() );
291 CHECK_VALUE(ok,
"Study Description doesn't match : ",
"OS 0.5", series->getDescription() );
292 CHECK_VALUE(ok,
"Study Description doesn't match : ",
"", study->getDescription() );
295 fwMedData::DicomValuesType physiciansName;
296 ok &= (physiciansName == series->getPerformingPhysiciansName());
297 OSLM_ERROR_IF(
"Name of the physician(s) administering the Series doesn't match : ",
298 (physiciansName == series->getPerformingPhysiciansName()));
303 CHECK_VALUE(ok,
"Patient's Name doesn't match : ",
"CHARNOZ ARNAUD", patient->getName() );
305 CHECK_VALUE(ok,
"Patient ID doesn't match : ",
"12592 ARTHRO GENOU G", patient->getPatientId() );
307 CHECK_VALUE(ok,
"Patient's Birth Date doesn't match : ",
"19790618", patient->getBirthdate() );
309 CHECK_VALUE(ok,
"Patient's Sex doesn't match :",
"M", patient->getSex() );
311 CHECK_VALUE(ok,
"Study Patient's Age doesn't match :",
"029Y", study->getPatientAge() );
336 CHECK_VALUE(ok,
"Study Instance UID doesn't match :",
"1.2.392.200036.9116.2.6.1.48.1211418863.1225183167.375775",
337 study->getInstanceUID() );
339 CHECK_VALUE(ok,
"Series Instance UID doesn't match :",
"1.2.392.200036.9116.2.6.1.48.1211418863.1225184516.765855",
340 series->getInstanceUID() );
354 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image x origin doesn't match :", -36.71875, img->getOrigin()[0], 0.01);
355 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image y origin doesn't match :", -88.28125, img->getOrigin()[1], 0.01);
356 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image z origin doesn't match :", 1350.300, img->getOrigin()[2], 0.01);
366 CHECK_VALUE(ok,
"Image x size doesn't match :", 512, img->getSize()[0] );
367 CHECK_VALUE(ok,
"Image y size doesn't match :", 512, img->getSize()[1] );
368 CHECK_VALUE(ok,
"Image z size doesn't match :", 404, img->getSize()[2] );
370 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image x spacing doesn't match :", 0.384, img->getSpacing()[0], 0.001);
371 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image y spacing doesn't match :", 0.384, img->getSpacing()[1], 0.001);
372 CHECK_VALUE_WITH_TOLERANCE(ok,
"Image z spacing doesn't match :", 0.399, img->getSpacing()[2], 0.001);
375 CHECK_VALUE(notReallyChecked,
"Image Bits Allocated correspond :", 16, img->getType().sizeOf() * 8 );
378 CHECK_VALUE(notReallyChecked,
"Image Bits Allocated correspond :",
false, img->getType().isSigned() );
380 CHECK_VALUE(ok,
"Image Window Center correspond :", 500, img->getWindowCenter() );
382 CHECK_VALUE(ok,
"Image Window Width correspond :", 2500, img->getWindowWidth() );
static FWTEST_API bool checkSeriesACHGenouTrimmed(const std::shared_ptr< ::fwMedData::ImageSeries > &series)
This method is the same as checkSeriesACHGenou but it checks trimmed strings instead of even sized st...
#define OSLM_ERROR(message)
static FWTEST_API bool checkSeriesACHGenou(const std::shared_ptr< ::fwMedData::ImageSeries > &series)
Method used to verify if a specific dicom file (stored on the test database) is well read...
#define OSLM_ERROR_IF(message, cond)