+
+// We assume the use *does* know all the files whose names
+// are in InternalFileNameList exist, may be open, are gdcm-readable
+// have the same sizes, have the same 'pixel' type, are single frame
+// have the same color convention, ..., anything else ?
+
+int vtkGdcmReader::CheckFileCoherenceAlreadyDone()
+{
+ if ( CoherentFileList->empty() )
+ {
+ vtkErrorMacro(<< "Coherent File List is empty ");
+ return 0;
+ }
+
+ gdcm::File *gdcmFile = (*CoherentFileList)[0];
+
+ int NX = gdcmFile->GetXSize();
+ int NY = gdcmFile->GetYSize();
+ // CheckFileCoherenceLight should be called *only* when user knows
+ // he deals with single frames files.
+ // Z size is then the number of files.
+ // --> TODO : loop on the File* to get NZ of each one !
+ int NZ = CoherentFileList->size();
+ std::string type = gdcmFile->GetPixelType();
+ //vtkDebugMacro(<< "The first file is taken as reference: "
+ // << (*CoherentFileList)[0]->GetFileName() );
+ vtkDebugMacro(<< "Image dimensions of reference file as read from Gdcm:"
+ << NX << " " << NY << " " << NZ);
+ vtkDebugMacro(<< "Number of planes added to the stack: " << NZ);
+ // Set aside the size of the image
+ this->NumColumns = NX;
+ this->NumLines = NY;
+ this->ImageType = type;
+ this->PixelSize = gdcmFile->GetPixelSize();
+
+ if( gdcmFile->HasLUT() && this->AllowLookupTable )
+ {
+ // I could raise an error is AllowLookupTable is on and HasLUT() off
+ this->NumComponents = gdcmFile->GetNumberOfScalarComponentsRaw();
+ }
+ else
+ {
+ this->NumComponents = gdcmFile->GetNumberOfScalarComponents(); //rgb or mono
+ }
+
+ //Set image spacing
+ this->DataSpacing[0] = gdcmFile->GetXSpacing();
+ this->DataSpacing[1] = gdcmFile->GetYSpacing();
+ this->DataSpacing[2] = gdcmFile->GetZSpacing();
+
+ return NZ;
+}