Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDICOMDCMTKTagScannerTest.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
19 
20 #include "mitkTestFixture.h"
21 #include "mitkTestingMacros.h"
22 
23 #include "mitkStringProperty.h"
24 
25 class mitkDICOMDCMTKTagScannerTestSuite : public mitk::TestFixture
26 {
27  CPPUNIT_TEST_SUITE(mitkDICOMDCMTKTagScannerTestSuite);
28 
29  MITK_TEST(DeepScanning);
30  MITK_TEST(MultiFileScanning);
31 
32  CPPUNIT_TEST_SUITE_END();
33 
34 private:
35 
37 
38  mitk::StringList doseFiles;
39  mitk::StringList ctFiles;
40 
41 public:
42 
43  void setUp() override
44  {
45  doseFiles.push_back(GetTestDataFilePath("RT/Dose/RD.dcm"));
46  ctFiles.push_back(GetTestDataFilePath("TinyCTAbdomen/100"));
47  ctFiles.push_back(GetTestDataFilePath("TinyCTAbdomen/101"));
48  ctFiles.push_back(GetTestDataFilePath("TinyCTAbdomen/102"));
49  ctFiles.push_back(GetTestDataFilePath("TinyCTAbdomen/104"));
50 
52  }
53 
54  void tearDown() override
55  {
56  }
57 
58  void DeepScanning()
59  {
60  mitk::DICOMTagPath planUIDPath;
61  planUIDPath.AddAnySelection(0x300C, 0x0002).AddElement(0x0008, 0x1155);
62  mitk::DICOMTagPath planUIDPathRef;
63  planUIDPathRef.AddSelection(0x300C, 0x0002, 0).AddElement(0x0008,0x1155);
64 
65  mitk::DICOMTagPath patientName(0x0010, 0x0010);
66 
67  scanner->SetInputFiles(doseFiles);
68  scanner->AddTagPath(planUIDPath);
69  scanner->AddTagPath(patientName);
70 
71  scanner->Scan();
72 
73  mitk::DICOMDatasetAccessingImageFrameList frames = scanner->GetFrameInfoList();
74  CPPUNIT_ASSERT_MESSAGE("Testing DICOMDCMTKTagScanner::GetFrameInfoList()", frames.size() == 1);
75 
76  mitk::DICOMDatasetAccess::FindingsListType findings = frames.front()->GetTagValueAsString(planUIDPath);
77  CPPUNIT_ASSERT_MESSAGE("Testing DICOMDCMTKTagScanner::GetFrameInfoList()", findings.size() == 1);
78  CPPUNIT_ASSERT_MESSAGE("Testing validity of first plan finding", findings.front().isValid);
79  CPPUNIT_ASSERT_MESSAGE("Testing path of first plan finding", findings.front().path == planUIDPathRef);
80  CPPUNIT_ASSERT_MESSAGE("Testing value of first plan finding", findings.front().value == "1.2.826.0.1.3680043.8.176.2013826104526987.672.1228523524");
81 
82  findings = frames.front()->GetTagValueAsString(patientName);
83  CPPUNIT_ASSERT_MESSAGE("Testing DICOMDCMTKTagScanner::GetFrameInfoList()", findings.size() == 1);
84  CPPUNIT_ASSERT_MESSAGE("Testing validity of first plan finding", findings.front().isValid);
85  CPPUNIT_ASSERT_MESSAGE("Testing path of first plan finding", findings.front().path == patientName);
86  CPPUNIT_ASSERT_MESSAGE("Testing value of first plan finding", findings.front().value == "L_H");
87  }
88 
89  void MultiFileScanning()
90  {
91  mitk::DICOMTagPath instanceUID(0x0008, 0x0018);
92 
93  scanner->SetInputFiles(ctFiles);
94  scanner->AddTagPath(instanceUID);
95 
96  scanner->Scan();
97 
98  mitk::DICOMDatasetAccessingImageFrameList frames = scanner->GetFrameInfoList();
99  CPPUNIT_ASSERT_MESSAGE("Testing DICOMDCMTKTagScanner::GetFrameInfoList()", frames.size() == 4);
100 
101  mitk::DICOMDatasetAccess::FindingsListType findings = frames[0]->GetTagValueAsString(instanceUID);
102  CPPUNIT_ASSERT_MESSAGE("Testing DICOMDCMTKTagScanner::GetFrameInfoList()", findings.size() == 1);
103  CPPUNIT_ASSERT_MESSAGE("Testing validity of instance uid finding of frame 0", findings.front().isValid);
104  CPPUNIT_ASSERT_MESSAGE("Testing path of instance uid finding of frame 0", findings.front().path == instanceUID);
105  CPPUNIT_ASSERT_MESSAGE("Testing value of instance uid finding of frame 0", findings.front().value == "1.2.276.0.99.1.4.8323329.3795.1303917947.940051");
106 
107  findings = frames[1]->GetTagValueAsString(instanceUID);
108  CPPUNIT_ASSERT_MESSAGE("Testing DICOMDCMTKTagScanner::GetFrameInfoList()", findings.size() == 1);
109  CPPUNIT_ASSERT_MESSAGE("Testing validity of instance uid finding of frame 1", findings.front().isValid);
110  CPPUNIT_ASSERT_MESSAGE("Testing path of instance uid finding of frame 1", findings.front().path == instanceUID);
111  CPPUNIT_ASSERT_MESSAGE("Testing value of instance uid finding of frame 1", findings.front().value == "1.2.276.0.99.1.4.8323329.3795.1303917947.940052");
112 
113  findings = frames[2]->GetTagValueAsString(instanceUID);
114  CPPUNIT_ASSERT_MESSAGE("Testing DICOMDCMTKTagScanner::GetFrameInfoList()", findings.size() == 1);
115  CPPUNIT_ASSERT_MESSAGE("Testing validity of instance uid finding of frame 2", findings.front().isValid);
116  CPPUNIT_ASSERT_MESSAGE("Testing path of instance uid finding of frame 2", findings.front().path == instanceUID);
117  CPPUNIT_ASSERT_MESSAGE("Testing value of instance uid finding of frame 2", findings.front().value == "1.2.276.0.99.1.4.8323329.3795.1303917947.940053");
118 
119  findings = frames[3]->GetTagValueAsString(instanceUID);
120  CPPUNIT_ASSERT_MESSAGE("Testing DICOMDCMTKTagScanner::GetFrameInfoList()", findings.size() == 1);
121  CPPUNIT_ASSERT_MESSAGE("Testing validity of instance uid finding of frame 3", findings.front().isValid);
122  CPPUNIT_ASSERT_MESSAGE("Testing path of instance uid finding of frame 3", findings.front().path == instanceUID);
123  CPPUNIT_ASSERT_MESSAGE("Testing value of instance uid finding of frame 3", findings.front().value == "1.2.276.0.99.1.4.8323329.3795.1303917947.940055");
124  }
125 
126 };
127 
128 MITK_TEST_SUITE_REGISTRATION(mitkDICOMDCMTKTagScanner)
section MAP_FRAME_Mapper_Settings Mapper settings For the mapping of corrected you have several settings but high interpolation errors for gray value images Right choice for label images or masks li Details of the frame selection In this tab you can specify the frames of the currently selected image that should be corrected As default all frames of an image will be corrected If you only select specific frames
DICOMTagPath & AddElement(unsigned int group, unsigned int element)
DICOMTagPath & AddAnySelection(unsigned int group, unsigned int element)
itk::SmartPointer< Self > Pointer
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag...
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
static std::string GetTestDataFilePath(const std::string &testData)
Get the absolute path for test data.
std::list< DICOMDatasetFinding > FindingsListType
Test fixture for parameterized tests.
std::vector< std::string > StringList
std::vector< DICOMDatasetAccessingImageFrameInfo::Pointer > DICOMDatasetAccessingImageFrameList
DICOMTagPath & AddSelection(unsigned int group, unsigned int element, ItemSelectionIndex index)