X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vtk%2FvtkGdcmReader.cxx;h=13ab070f8fdc556f2b9c6dc685bc5e39ab7e2b52;hb=6f03d7978c122dfc2c7a0ee6bc9f2fd019d98ca3;hp=652d309c97ccbc93f102f175c083df54e35fe7ad;hpb=fbe63cedab40c65324b66e5f4ec14e4d78f0695c;p=gdcm.git diff --git a/vtk/vtkGdcmReader.cxx b/vtk/vtkGdcmReader.cxx index 652d309c..13ab070f 100644 --- a/vtk/vtkGdcmReader.cxx +++ b/vtk/vtkGdcmReader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: vtkGdcmReader.cxx,v $ Language: C++ - Date: $Date: 2007/10/03 15:49:51 $ - Version: $Revision: 1.93 $ + Date: $Date: 2009/11/03 14:07:00 $ + Version: $Revision: 1.97 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -59,7 +59,7 @@ // 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(); @@ -92,7 +92,7 @@ #include #include -vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.93 $") +vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.97 $") vtkStandardNewMacro(vtkGdcmReader) //----------------------------------------------------------------------------- @@ -113,6 +113,8 @@ vtkGdcmReader::vtkGdcmReader() // this->Execution=false; // For VTK5.0 this->KeepOverlays = false; + + this->FlipY = true; // to keep old behaviour } vtkGdcmReader::~vtkGdcmReader() @@ -280,7 +282,7 @@ void vtkGdcmReader::ExecuteInformation() 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(); @@ -335,7 +337,9 @@ void vtkGdcmReader::ExecuteData(vtkDataObject *output) //} // end For VTK5.0 data->AllocateScalars(); // For VTK5.0 -#if (VTK_MAJOR_VERSION >= 5) + +#if (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2 ) +//#if (VTK_MAJOR_VERSION >= 5) if (this->UpdateExtentIsEmpty(output)) { return; @@ -509,11 +513,12 @@ void vtkGdcmReader::LoadFileInformation() type = file->GetPixelType(); if ( (type != "8U") && (type != "8S") && (type != "16U") && (type != "16S") - && (type != "32U") && (type != "32S") ) + && (type != "32U") && (type != "32S") + && (type != "FD") ) // Sure this one is NOT 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; @@ -853,9 +858,14 @@ void vtkGdcmReader::LoadImageInMemory( { //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++) { @@ -875,7 +885,11 @@ void vtkGdcmReader::LoadImageInMemory( } dst += 2 * planeSize; } - +} +else // we don't flip (upside down) the image +{ + memcpy((void*)dest, (void*)src, numPlanes * numLines * lineSize); +} fileH->Delete(); }