+2003-10-03 Mathieu Malaterre <Mathieu.Malaterre@creatis.insa-lyon.fr>
+ * vtkGdcmReader is now able to read rgb dicom file.
+ * src/gdcmHeaderHelper : GetNumberOfScalarComponents()
2003-10-02 Mathieu Malaterre <Mathieu.Malaterre@creatis.insa-lyon.fr>
* src/*.cxx removed pragma thingies to src/gdcmCommon.h
Two reasons: - clear things
-// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.19 2003/09/10 09:31:55 malaterre Exp $
+// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.20 2003/10/03 14:48:31 malaterre Exp $
// //////////////////////////////////////////////////////////////
// WARNING TODO CLENAME
// Actual limitations of this code:
ReturnedTotalNumberOfPlanes += NZ - 1; // First plane already added
this->ImageType = type;
this->PixelSize = GdcmHeader.GetPixelSize();
+ this->NumComponents = GdcmHeader.GetNumberOfScalarComponents(); //rgb or mono
//Set image spacing
this->DataSpacing[0] = GdcmHeader.GetXSpacing();
this->SetDataScalarTypeToInt();
}
+ //Set number of scalar components:
+ this->SetNumberOfScalarComponents(this->NumComponents);
+
vtkImageReader::ExecuteInformation();
}
int NumColumns = GdcmFile.GetXSize();
int NumLines = GdcmFile.GetYSize();
int NumPlanes = GdcmFile.GetZSize();
- int LineSize = NumColumns * GdcmFile.GetPixelSize();
+ int LineSize = NumComponents * NumColumns * GdcmFile.GetPixelSize();
unsigned char * Source = (unsigned char*)GdcmFile.GetImageData();
unsigned char * pSource = Source; //pointer for later deletion
unsigned char * Destination = Dest + size - LineSize;
// 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->TotalNumberOfPlanes * this->NumComponents;
size_t stack_size = StackNumPixels * this->PixelSize;
// Allocate pixel data space itself.
unsigned char *mem = new unsigned char [stack_size];
-// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.h,v 1.9 2003/07/07 10:06:36 regrain Exp $
+// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.h,v 1.10 2003/10/03 14:48:31 malaterre Exp $
#ifndef __vtkGdcmReader_h
#define __vtkGdcmReader_h
int NumLines;
// Total number of planes (or images) of the stack to be build.
int TotalNumberOfPlanes;
+ // Number of scalar components of the image to be loaded (1=monochrome 3=rgb)
+ int NumComponents;
// Type of the image[s]: 8/16/32 bits, signed/unsigned:
std::string ImageType;
// Pixel size (in number of bytes):