- gdcm::FileHelper *f1 = new gdcm::FileHelper(e1);
- f1->SetPrintLevel( level );
-
- f1->Print();
-
- std::cout << "\n\n" << std::endl;
-
- std::cout <<std::endl;
- std::cout <<" dataSize " << f1->GetImageDataSize() << std::endl;
- std::cout <<" dataSizeRaw " << f1->GetImageDataRawSize() << std::endl;
-
- int nX,nY,nZ,sPP,planarConfig;
- std::string pixelType;
- nX=e1->GetXSize();
- nY=e1->GetYSize();
- nZ=e1->GetZSize();
- std::cout << " DIMX=" << nX << " DIMY=" << nY << " DIMZ=" << nZ << std::endl;
-
- pixelType = e1->GetPixelType();
- sPP = e1->GetSamplesPerPixel();
- planarConfig = e1->GetPlanarConfiguration();
-
- std::cout << " pixelType= [" << pixelType
- << "] SamplesPerPixel= [" << sPP
- << "] PlanarConfiguration= [" << planarConfig
- << "] "<< std::endl
- << " PhotometricInterpretation= ["
- << e1->GetEntryValue(0x0028,0x0004)
- << "] "<< std::endl;
-
- int numberOfScalarComponents=e1->GetNumberOfScalarComponents();
- std::cout << " NumberOfScalarComponents = " << numberOfScalarComponents
- <<std::endl
- << " LUT = " << (e1->HasLUT() ? "TRUE" : "FALSE")
- << std::endl;
-
- if ( e1->GetEntryValue(0x0002,0x0010) == gdcm::GDCM_NOTLOADED )
- {
- std::cout << "Transfer Syntax not loaded. " << std::endl
- << "Better you increase MAX_SIZE_LOAD_ELEMENT_VALUE"
+ for (int ri=0; ri<forceLoadNb; ri++)
+ {
+ f->AddForceLoadElement((uint32_t)elemsToForceLoad[2*ri],
+ (uint32_t)elemsToForceLoad[2*ri+1] );
+ }
+
+ bool res = f->Load();
+
+ if ( !res )
+ {
+ std::cout << "Cannot process file [" << fileName << "]" << std::endl;
+ std::cout << "Either it doesn't exist, or it's read protected "
+ << std::endl;
+ std::cout << "or it's not a Dicom File, or its 'header' is bugged"
+ << std::endl;
+ std::cout << "use 'PrintFile filein=... debug' to try to guess the pb"
+ << std::endl;
+ delete f;
+ return 0;
+ }
+
+ gdcm::FileHelper *fh = new gdcm::FileHelper(f);
+ fh->SetPrintLevel( level );
+
+ fh->Print();
+
+ std::cout << "\n\n" << std::endl;
+
+ std::cout <<std::endl;
+ std::cout <<" dataSize " << fh->GetImageDataSize() << std::endl;
+ std::cout <<" dataSizeRaw " << fh->GetImageDataRawSize() << std::endl;
+
+ int nX,nY,nZ,sPP,planarConfig;
+ std::string pixelType;
+ nX=f->GetXSize();
+ nY=f->GetYSize();
+ nZ=f->GetZSize();
+ std::cout << " DIMX=" << nX << " DIMY=" << nY << " DIMZ=" << nZ << std::endl;
+
+ pixelType = f->GetPixelType();
+ sPP = f->GetSamplesPerPixel();
+ planarConfig = f->GetPlanarConfiguration();
+
+ std::cout << " pixelType= [" << pixelType
+ << "] SamplesPerPixel= [" << sPP
+ << "] PlanarConfiguration= [" << planarConfig
+ << "] "<< std::endl
+ << " PhotometricInterpretation= ["
+ << f->GetEntryValue(0x0028,0x0004)
+ << "] "<< std::endl;
+
+ int numberOfScalarComponents=f->GetNumberOfScalarComponents();
+ std::cout << " NumberOfScalarComponents = " << numberOfScalarComponents
+ <<std::endl
+ << " LUT = " << (f->HasLUT() ? "TRUE" : "FALSE")