@@ -92,7 +92,7 @@ bool milxQtFile::openImage(const QString filename, vtkImageData* data)
9292 charFormat = true ;
9393 itk::ObjectFactoryBase::RegisterFactory ( itk::RawImageIOFactory<unsigned char , 3 >::New () );
9494 }
95- if (typeStr == " unsigned" || typeStr == " unsigned_short" || typeStr == " short" || typeStr == " unsigned short" || typeStr == " unsigned_int" || typeStr == " unsigned int" || typeStr == " int" ) // 16-bit or 32-bit integers
95+ else if (typeStr == " unsigned" || typeStr == " unsigned_short" || typeStr == " short" || typeStr == " unsigned short" || typeStr == " unsigned_int" || typeStr == " unsigned int" || typeStr == " int" ) // 16-bit or 32-bit integers
9696 integerFormat = true ;
9797 else if (extension == " vti" )
9898 {
@@ -298,16 +298,16 @@ bool milxQtFile::openImage(const QString filename, milxQtImage* data)
298298
299299 if (!vtkFormat && !pnmImage)
300300 {
301- cout << " Trying to read image header ..." << endl;
302- // Check type of medical image
303- std::string pixelType, componentType;
304- if (!milx::File::ReadImageInformation (filename.toStdString (), pixelType, componentType, dataDimensions))
305- {
306- cerr << " Failed reading header of image. File may not be an image. Exiting" << endl;
307- return false ;
308- }
309- dataPixelType = pixelType.c_str ();
310- dataComponentType = componentType.c_str ();
301+ cout << " Trying to read image header ..." << endl;
302+ // Check type of medical image
303+ std::string pixelType, componentType;
304+ if (!milx::File::ReadImageInformation (filename.toStdString (), pixelType, componentType, dataDimensions))
305+ {
306+ cerr << " Failed reading header of image. File may not be an image. Exiting" << endl;
307+ return false ;
308+ }
309+ dataPixelType = pixelType.c_str ();
310+ dataComponentType = componentType.c_str ();
311311
312312 if ((componentType == " unsigned_char" && pixelType == " scalar" ) || (componentType == " unsigned char" && pixelType == " scalar" ))
313313 {
@@ -338,7 +338,7 @@ bool milxQtFile::openImage(const QString filename, milxQtImage* data)
338338
339339 data->SetInput (charImg, true );
340340 }
341- if (integerFormat)
341+ else if (integerFormat)
342342 {
343343 intImageType::Pointer intImg;
344344
0 commit comments