X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vtk%2FvtkGdcmReader.cxx;h=11d9f68076f835e9ec4a2a770822ae1ffe973d20;hb=b49d7069fe20162182a1840fd06afd3351f50b3d;hp=4b6685e097dba9bd99daca93e90e12845dca8479;hpb=fc845cfade351c5d9cf0aba8684e6a0ab93e9faa;p=gdcm.git diff --git a/vtk/vtkGdcmReader.cxx b/vtk/vtkGdcmReader.cxx index 4b6685e0..11d9f680 100644 --- a/vtk/vtkGdcmReader.cxx +++ b/vtk/vtkGdcmReader.cxx @@ -58,11 +58,15 @@ #include #include +vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.46 $"); +vtkStandardNewMacro(vtkGdcmReader); + //----------------------------------------------------------------------------- // Constructor / Destructor vtkGdcmReader::vtkGdcmReader() { this->LookupTable = NULL; + this->AllowLookupTable = 0; } vtkGdcmReader::~vtkGdcmReader() @@ -123,7 +127,6 @@ void vtkGdcmReader::SetFileName(const char *name) // (see vtkGdcmReader::AddFileName), we additionaly need to purge // this list when we manually positionate the filename. vtkDebugMacro("Clearing all files given with AddFileName"); - this->SetFilePattern(""); this->FileNameList.clear(); this->Modified(); } @@ -261,9 +264,9 @@ void vtkGdcmReader::ExecuteData(vtkDataObject *output) { // The memory size for a full stack of images of course depends // on the number of planes and the size of each image: - size_t StackNumPixels = this->NumColumns * this->NumLines - * this->TotalNumberOfPlanes * this->NumComponents; - size_t stack_size = StackNumPixels * this->PixelSize; + //size_t StackNumPixels = this->NumColumns * this->NumLines + // * this->TotalNumberOfPlanes * this->NumComponents; + //size_t stack_size = StackNumPixels * this->PixelSize; //not used // Allocate pixel data space itself. // Variables for the UpdateProgress. We shall use 50 steps to signify @@ -441,7 +444,7 @@ int vtkGdcmReader::CheckFileCoherence() fclose(fp); // Stage 1.2: check for Gdcm parsability - gdcmHeaderHelper GdcmHeader(FileName->c_str(), false, true); + gdcmHeader GdcmHeader(FileName->c_str(), false, true); // true : for enableSequences if (!GdcmHeader.IsReadable()) { @@ -530,8 +533,9 @@ int vtkGdcmReader::CheckFileCoherence() this->ImageType = type; this->PixelSize = GdcmHeader.GetPixelSize(); - if( GdcmHeader.HasLUT() ) + if( GdcmHeader.HasLUT() && this->AllowLookupTable ) { + // I could raise an error is AllowLookupTable is on and HasLUT() off this->NumComponents = GdcmHeader.GetNumberOfScalarComponentsRaw(); } else @@ -625,7 +629,7 @@ size_t vtkGdcmReader::LoadImageInMemory( unsigned char * Source; - if( GdcmFile.GetHeader()->HasLUT() ) + if( GdcmFile.GetHeader()->HasLUT() && this->AllowLookupTable ) { size = GdcmFile.GetImageDataSizeRaw(); Source = (unsigned char*) GdcmFile.GetImageDataRaw(); @@ -684,7 +688,7 @@ size_t vtkGdcmReader::LoadImageInMemory( // fclose(f2); //GetImageData allocate a (void*)malloc, remove it: - free(pSource); + delete[] pSource; return size; }