-// vtkGdcmReader.cxx
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: vtkGdcmReader.cxx,v $
+ Language: C++
+ Date: $Date: 2004/12/09 10:59:59 $
+ Version: $Revision: 1.64 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
//-----------------------------------------------------------------------------
// //////////////////////////////////////////////////////////////
// WARNING TODO CLEANME
#include <vtkPointData.h>
#include <vtkLookupTable.h>
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.60 $");
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.64 $");
vtkStandardNewMacro(vtkGdcmReader);
//-----------------------------------------------------------------------------
&& (type != "16U") && (type != "16S")
&& (type != "32U") && (type != "32S") )
{
- vtkErrorMacro(<< "Bad File Type for file" << filename->c_str());
- vtkErrorMacro(<< " " << type.c_str());
- vtkErrorMacro(<< "Removing this file from readed files "
- << filename->c_str());
+ vtkErrorMacro(<< "Bad File Type for file " << filename->c_str() << "\n"
+ << " File type found : " << type.c_str()
+ << " (might be 8U, 8S, 16U, 16S, 32U, 32S) \n"
+ << " Removing this file from readed files");
*filename = "GDCM_UNREADABLE";
continue;
}
this->DataSpacing[2] = GdcmHeader.GetZSpacing();
//Set image origin
- this->DataOrigin[0] = GdcmHeader.GetXOrigin();
- this->DataOrigin[1] = GdcmHeader.GetYOrigin();
- this->DataOrigin[2] = GdcmHeader.GetZOrigin();
+ //this->DataOrigin[0] = GdcmHeader.GetXOrigin();
+ //this->DataOrigin[1] = GdcmHeader.GetYOrigin();
+ //this->DataOrigin[2] = GdcmHeader.GetZOrigin();
}
} // End of loop on filename
*/
size_t vtkGdcmReader::LoadImageInMemory(
std::string fileName,
- unsigned char * dest,
+ unsigned char *dest,
const unsigned long updateProgressTarget,
unsigned long & updateProgressCount)
{
int numLines = file.GetHeader()->GetYSize();
int numPlanes = file.GetHeader()->GetZSize();
int lineSize = NumComponents * numColumns * file.GetHeader()->GetPixelSize();
+ int planeSize = lineSize * numLines;
- unsigned char * source;
+ unsigned char *src;
if( file.GetHeader()->HasLUT() && AllowLookupTable )
{
size = file.GetImageDataSize();
- source = (unsigned char*) file.GetImageDataRaw();
+ src = (unsigned char*) file.GetImageDataRaw();
unsigned char *lut = (unsigned char*) file.GetLutRGBA();
if(!this->LookupTable)
}
else
{
- size = file.GetImageDataSize();
- source = (unsigned char*)file.GetImageData();
+ size = file.GetImageDataSize();
+ src = (unsigned char*)file.GetImageData();
}
-
- unsigned char * destination = dest + size - lineSize;
+ unsigned char *dst = dest + planeSize - lineSize;
for (int plane = 0; plane < numPlanes; plane++)
{
for (int line = 0; line < numLines; line++)
{
- cerr << line << endl;
// Copy one line at proper destination:
- memcpy((void*)destination, (void*)source, lineSize);
- source += lineSize;
- destination -= lineSize;
+ memcpy((void*)dst, (void*)src, lineSize);
+ src += lineSize;
+ dst -= lineSize;
// Update progress related:
if (!(updateProgressCount%updateProgressTarget))
{
}
updateProgressCount++;
}
+ dst += 2 * planeSize;
}
-// DO NOT remove this commented out code .
-// Nobody knows what's expecting you ...
-// Just to 'see' what was actually read on disk :-(
-
-// FILE * f2;
-// f2 = fopen("SpuriousFile.RAW","wb");
-// fwrite(Dest,size,1,f2);
-// fclose(f2);
-
return size;
}