Program: gdcm
Module: $RCSfile: vtkGdcmReader.cxx,v $
Language: C++
- Date: $Date: 2005/04/28 09:29:05 $
- Version: $Revision: 1.69 $
+ Date: $Date: 2005/06/29 16:12:43 $
+ Version: $Revision: 1.72 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmFileHelper.h"
#include "gdcmFile.h"
+#include "gdcmDocument.h" // for NO_SEQ
+
#include "vtkGdcmReader.h"
+#include "gdcmDebug.h"
//#include <stdio.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
#include <vtkLookupTable.h>
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.69 $");
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.72 $");
vtkStandardNewMacro(vtkGdcmReader);
//-----------------------------------------------------------------------------
this->LookupTable = NULL;
this->AllowLookupTable = 0;
this->LightChecking = false;
+ this->LoadMode = 0; // Load everything (possible values : NO_SEQ, NO_SHADOW
+ // NO_SHADOWSEQ)
}
vtkGdcmReader::~vtkGdcmReader()
//-----------------------------------------------------------------------------
// Print
-void vtkGdcmReader::PrintSelf(ostream& os, vtkIndent indent)
+void vtkGdcmReader::PrintSelf(ostream &os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
os << indent << "Filenames : " << endl;
}
/*
- * Ask for a 'light' checking - actually : just initializing-
+ * Ask for a 'light' checking -actually : just initializing-
*if you are 150% sure *all* the files are coherent
*/
void vtkGdcmReader::SetCheckFileCoherenceLight()
//gdcm::File GdcmFile( filename->c_str() );
// to save some parsing time.
gdcm::File GdcmFile;
- GdcmFile.SetLoadMode( NO_SEQ | NO_SHADOW );
+ GdcmFile.SetLoadMode( LoadMode );
GdcmFile.Load(filename->c_str() );
if (!GdcmFile.IsReadable())
{
std::string fileName,
unsigned char *dest,
const unsigned long updateProgressTarget,
- unsigned long & updateProgressCount)
+ unsigned long &updateProgressCount)
{
vtkDebugMacro(<< "Copying to memory image [" << fileName.c_str() << "]");
- gdcm::FileHelper file( fileName.c_str() );
+ gdcm::File *f;
+ f = new gdcm::File();
+ f->SetLoadMode( LoadMode );
+ f->Load( fileName.c_str() );
+
+ gdcm::FileHelper fileH( f );
size_t size;
// If the data structure of vtk for image/volume representation
// line comes first (for some axis related reasons?). Hence we need
// to load the image line by line, starting from the end.
- int numColumns = file.GetFile()->GetXSize();
- int numLines = file.GetFile()->GetYSize();
- int numPlanes = file.GetFile()->GetZSize();
- int lineSize = NumComponents * numColumns * file.GetFile()->GetPixelSize();
+ int numColumns = fileH.GetFile()->GetXSize();
+ int numLines = fileH.GetFile()->GetYSize();
+ int numPlanes = fileH.GetFile()->GetZSize();
+ int lineSize = NumComponents * numColumns * fileH.GetFile()->GetPixelSize();
int planeSize = lineSize * numLines;
unsigned char *src;
- if( file.GetFile()->HasLUT() && AllowLookupTable )
+ if( fileH.GetFile()->HasLUT() && AllowLookupTable )
{
- size = file.GetImageDataSize();
- src = (unsigned char*) file.GetImageDataRaw();
- unsigned char *lut = (unsigned char*) file.GetLutRGBA();
+ size = fileH.GetImageDataSize();
+ src = (unsigned char*) fileH.GetImageDataRaw();
+ unsigned char *lut = (unsigned char*) fileH.GetLutRGBA();
if(!this->LookupTable)
{
}
else
{
- size = file.GetImageDataSize();
- src = (unsigned char*)file.GetImageData();
+ size = fileH.GetImageDataSize();
+ src = (unsigned char*)fileH.GetImageData();
}
unsigned char *dst = dest + planeSize - lineSize;
updateProgressCount++;
}
dst += 2 * planeSize;
- }
+ }
+ delete f;
return size;
}
std::list<std::string>::iterator filename = InternalFileNameList.begin();
gdcm::File GdcmFile;
- GdcmFile.SetLoadMode( NO_SEQ | NO_SHADOW );
+ GdcmFile.SetLoadMode( LoadMode );
GdcmFile.Load(filename->c_str() );
if (!GdcmFile.IsReadable())
{
}
int NX = GdcmFile.GetXSize();
int NY = GdcmFile.GetYSize();
- int NZ = GdcmFile.GetZSize();
+ // CheckFileCoherenceLight should be called *only* when user knows
+ // he deals with single frames files.
+ // Z size is then the number of files.
+ int NZ = InternalFileNameList.size();
std::string type = GdcmFile.GetPixelType();
vtkDebugMacro(<< "The first file is taken as reference: "
<< filename->c_str());