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

Method Load3DnT

Modules/DICOM/src/mitkITKDICOMSeriesReaderHelper.cpp:149–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147 return LoadDICOMByITK3DnT<T>( filenamesLists, correctTilt, tiltInfo, io );
148
149mitk::Image::Pointer mitk::ITKDICOMSeriesReaderHelper::Load3DnT( const StringContainerList& filenamesLists,
150 bool correctTilt,
151 const GantryTiltInformation& tiltInfo )
152{
153 if ( filenamesLists.empty() || filenamesLists.front().empty() )
154 {
155 MITK_DEBUG
156 << "Calling LoadDicomSeries with empty filename string container. Probably invalid application logic.";
157 return nullptr; // this is not actually an error but the result is very simple
158 }
159
160 typedef itk::GDCMImageIO DcmIoType;
161 DcmIoType::Pointer io = DcmIoType::New();
162
163 try
164 {
165 if ( io->CanReadFile( filenamesLists.front().front().c_str() ) )
166 {
167 io->SetFileName( filenamesLists.front().front().c_str() );
168 io->ReadImageInformation();
169
170 if ( io->GetPixelType() == itk::IOPixelEnum::SCALAR )
171 {
172 switch ( io->GetComponentType() )
173 {
174 switch3DnTCase(itk::IOComponentEnum::UCHAR, unsigned char) switch3DnTCase(itk::IOComponentEnum::CHAR, char)
175 switch3DnTCase(itk::IOComponentEnum::USHORT, unsigned short) switch3DnTCase(
176 itk::IOComponentEnum::SHORT, short) switch3DnTCase(itk::IOComponentEnum::UINT,
177 unsigned int) switch3DnTCase(itk::IOComponentEnum::INT, int)
178 switch3DnTCase(itk::IOComponentEnum::ULONG, long unsigned int) switch3DnTCase(itk::IOComponentEnum::LONG, long int)
179 switch3DnTCase(itk::IOComponentEnum::FLOAT, float) switch3DnTCase(itk::IOComponentEnum::DOUBLE, double) default
180 : MITK_ERROR
181 << "Found unsupported DICOM scalar pixel type: (enum value) "
182 << io->GetComponentType();
183 }
184 }
185 else if ( io->GetPixelType() == itk::IOPixelEnum::RGB )
186 {
187 switch ( io->GetComponentType() )
188 {
189 switch3DnTCase(itk::IOComponentEnum::UCHAR, itk::RGBPixel<unsigned char>)
190 switch3DnTCase(itk::IOComponentEnum::CHAR, itk::RGBPixel<char>) switch3DnTCase(
191 itk::IOComponentEnum::USHORT, itk::RGBPixel<unsigned short>) switch3DnTCase(itk::IOComponentEnum::SHORT,
192 itk::RGBPixel<short>)
193 switch3DnTCase(itk::IOComponentEnum::UINT, itk::RGBPixel<unsigned int>) switch3DnTCase(
194 itk::IOComponentEnum::INT, itk::RGBPixel<int>) switch3DnTCase(itk::IOComponentEnum::ULONG,
195 itk::RGBPixel<long unsigned int>)
196 switch3DnTCase(itk::IOComponentEnum::LONG, itk::RGBPixel<long int>) switch3DnTCase(
197 itk::IOComponentEnum::FLOAT, itk::RGBPixel<float>) switch3DnTCase(itk::IOComponentEnum::DOUBLE,
198 itk::RGBPixel<double>) default
199 : MITK_ERROR
200 << "Found unsupported DICOM scalar pixel type: (enum value) "
201 << io->GetComponentType();
202 }
203 }
204
205 MITK_ERROR << "Unsupported DICOM pixel type";
206 return nullptr;

Calls 7

frontMethod · 0.80
GetComponentTypeMethod · 0.80
whatMethod · 0.80
NewFunction · 0.50
emptyMethod · 0.45
SetFileNameMethod · 0.45
GetPixelTypeMethod · 0.45

Tested by

no test coverage detected