MCPcopy Create free account
hub / github.com/MITK/MITK / Load

Method Load

Modules/DICOM/src/mitkITKDICOMSeriesReaderHelper.cpp:92–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92mitk::Image::Pointer mitk::ITKDICOMSeriesReaderHelper::Load( const StringContainer& filenames,
93 bool correctTilt,
94 const GantryTiltInformation& tiltInfo )
95{
96 if ( filenames.empty() )
97 {
98 MITK_DEBUG
99 << "Calling LoadDicomSeries with empty filename string container. Probably invalid application logic.";
100 return nullptr; // this is not actually an error but the result is very simple
101 }
102
103 typedef itk::GDCMImageIO DcmIoType;
104 DcmIoType::Pointer io = DcmIoType::New();
105
106 try
107 {
108 if ( io->CanReadFile( filenames.front().c_str() ) )
109 {
110 io->SetFileName( filenames.front().c_str() );
111 io->ReadImageInformation();
112
113 if(io->GetNumberOfDimensions()==2 || io->GetSpacing(2)==0.)
114 {
115 if (filenames.size() > 1)
116 {
117 MITK_ERROR << "Invalid application logic was called to load multiple DICOM files into one image volume, but at least one DICOM file indicated that it is 2D.";
118 return nullptr;
119 }
120
121 return LoadByTypeDispatch<2>(filenames, correctTilt, tiltInfo, io);
122 }
123 else
124 {
125 return LoadByTypeDispatch<3>(filenames, correctTilt, tiltInfo, io);
126 }
127 }
128 }
129 catch ( const itk::MemoryAllocationError& e )
130 {
131 MITK_ERROR << "Out of memory. Cannot load DICOM series: " << e.what();
132 }
133 catch ( const std::exception& e )
134 {
135 MITK_ERROR << "Error encountered when loading DICOM series:" << e.what();
136 }
137 catch ( ... )
138 {
139 MITK_ERROR << "Unspecified error encountered when loading DICOM series.";
140 }
141
142 return nullptr;
143}
144
145#define switch3DnTCase( IOType, T ) \
146 case IOType: \

Callers 3

GetSeriesMethod · 0.45

Calls 7

frontMethod · 0.80
whatMethod · 0.80
NewFunction · 0.50
emptyMethod · 0.45
SetFileNameMethod · 0.45
GetSpacingMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected