Program: gdcm
Module: $RCSfile: vtkGdcmReader.cxx,v $
Language: C++
- Date: $Date: 2007/09/04 16:21:50 $
- Version: $Revision: 1.92 $
+ Date: $Date: 2009/11/03 14:05:23 $
+ Version: $Revision: 1.96 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// sh->SetDropDuplicatePositions(true);
//
// // Sorting the list is mandatory
-// // a side effect is to compute ZSpacing for the fle set
+// // a side effect is to compute ZSpacing for the file set
// sh->OrderFileList(l); // sort the list
//
// vtkGdcmReader *reader = vtkGdcmReader::New();
#include <vtkPointData.h>
#include <vtkLookupTable.h>
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.92 $")
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.96 $")
vtkStandardNewMacro(vtkGdcmReader)
//-----------------------------------------------------------------------------
// this->Execution=false; // For VTK5.0
this->KeepOverlays = false;
+
+ this->FlipY = true; // to keep old behaviour
}
vtkGdcmReader::~vtkGdcmReader()
vtkDebugMacro(<< "32 bits signed image");
this->SetDataScalarTypeToInt();
}
- else if ( ImageType == "FD" )
+ else if ( ImageType == "FD" ) // This is not genuine DICOM, but so usefull
{
vtkDebugMacro(<< "64 bits Double image");
this->SetDataScalarTypeToDouble();
//} // end For VTK5.0
data->AllocateScalars(); // For VTK5.0
+
+#if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2 )
+//#if (VTK_MAJOR_VERSION >= 5)
if (this->UpdateExtentIsEmpty(output))
{
return;
}
-
-//void vtkGdcmReader::BuildData(vtkDataObject *output) // For VTK5.0
-//{
-// vtkImageData *data = this->AllocateOutputData(output); // end For VTK5.0
+#endif
data->GetPointData()->GetScalars()->SetName("DicomImage-Volume");
type = file->GetPixelType();
if ( (type != "8U") && (type != "8S")
&& (type != "16U") && (type != "16S")
- && (type != "32U") && (type != "32S") )
+ && (type != "32U") && (type != "32S")
+ && (type != "FD") ) // Not so sure this one is kosher
{
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"
+ << " (might be 8U, 8S, 16U, 16S, 32U, 32S, FD) \n"
<< " Removing this file from read files");
file->Delete();
file=NULL;
this->LookupTable->SetRange(0,255);
vtkDataSetAttributes *a = this->GetOutput()->GetPointData();
a->GetScalars()->SetLookupTable(this->LookupTable);
- free(lut);
+ delete[] lut;
}
else
{
//size = fileH->GetImageDataSize();
// useless - just an accessor; 'size' unused
- src = (unsigned char*)fileH->GetImageData();
- }
+ //if (this->GetFlipY())
+ src = (unsigned char*)fileH->GetImageData();
+ //else
+ // very strange, but it doesn't work (I have to memcpy the pixels ?!?)
+ // dest = (unsigned char*)fileH->GetImageData();
+ }
+if (this->GetFlipY()) {
unsigned char *dst = dest + planeSize - lineSize;
for (int plane = 0; plane < numPlanes; plane++)
{
}
dst += 2 * planeSize;
}
-
+}
+else // we don't flip (upside down) the image
+{
+ memcpy((void*)dest, (void*)src, numPlanes * numLines * lineSize);
+}
fileH->Delete();
}