Program: gdcm
Module: $RCSfile: vtkGdcmReader.cxx,v $
Language: C++
- Date: $Date: 2005/06/06 08:38:29 $
- Version: $Revision: 1.71 $
+ 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.71 $");
+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;
- // Some images have a wrong length for 0x0000 element of private groups
- // Better we don't use NO_SHADOW as a default option
- //GdcmFile.SetLoadMode( NO_SEQ | NO_SHADOW );
- GdcmFile.SetLoadMode( NO_SEQ );
+ 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())
{
Program: gdcm
Module: $RCSfile: vtkGdcmReader.h,v $
Language: C++
- Date: $Date: 2005/04/28 09:29:05 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2005/06/29 16:12:43 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
vtkGetObjectMacro(LookupTable, vtkLookupTable);
+/**
+ * \brief Sets the LoadMode as a boolean string.
+ * NO_SEQ, NO_SHADOW, ... (nothing more, right now)
+ * WARNING : before using NO_SHADOW, be sure *all* your files
+ * contain accurate values in the 0x0000 element (if any)
+ * of *each* Shadow Group. The parser will fail if the size is wrong !
+ * @param mode Load mode to be used
+ */
+ void SetLoadMode (int mode) { LoadMode = mode; }
+
protected:
vtkGdcmReader();
~vtkGdcmReader();
// files patterned
std::list<std::string> InternalFileNameList;
//ETX
+
+ /// \brief Bit string integer (each one considered as a boolean)
+ /// Bit 0 : Skip Sequences, if possible
+ /// Bit 1 : Skip Shadow Groups if possible
+ /// Probabely, some more to add
+ int LoadMode;
};
//-----------------------------------------------------------------------------