]> Creatis software - gdcm.git/commitdiff
Add vtkGdcmReader::SetFlipY(bool) (default : true, to keep old behaviour)
authorjpr <jpr>
Sat, 18 Apr 2009 14:42:51 +0000 (14:42 +0000)
committerjpr <jpr>
Sat, 18 Apr 2009 14:42:51 +0000 (14:42 +0000)
false DOESN'T flip the image.
To be used by aware people only!

vtk/vtkGdcmReader.cxx
vtk/vtkGdcmReader.h
vtk/vtkgdcmViewer2.cxx

index a387d6119ece21a049cfce3d75a9f2bb314e2ad3..91bc6b408223892c69e9df85c0e08e09c271f82f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkGdcmReader.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/12/13 16:18:13 $
-  Version:   $Revision: 1.94 $
+  Date:      $Date: 2009/04/18 14:42:51 $
+  Version:   $Revision: 1.95 $
                                                                                 
   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 <vtkPointData.h>
 #include <vtkLookupTable.h>
 
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.94 $")
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.95 $")
 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()
@@ -855,9 +857,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
+      //   dest  = (unsigned char*)fileH->GetImageData();        
    } 
 
+
+if (this->GetFlipY()) {
    unsigned char *dst = dest + planeSize - lineSize;
    for (int plane = 0; plane < numPlanes; plane++)
    {
@@ -877,7 +884,11 @@ void vtkGdcmReader::LoadImageInMemory(
       }
       dst += 2 * planeSize;
    }
-
+}
+else
+{
+  memcpy((void*)dest, (void*)src,  numPlanes * numLines * lineSize);
+}
    fileH->Delete();
 }
 
index 9250b7f3856de83389c306035e84064914d6bf33..928013a772bf85fc050f587dcae4f7680a15bd9d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkGdcmReader.h,v $
   Language:  C++
-  Date:      $Date: 2007/09/04 16:21:50 $
-  Version:   $Revision: 1.35 $
+  Date:      $Date: 2009/04/18 14:42:51 $
+  Version:   $Revision: 1.36 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -64,15 +64,19 @@ public:
    // Description:
    // If this flag is set and the DICOM reader encounters a dicom file with 
    // lookup table the data will be kept as unsigned chars and a lookuptable 
-   // will be exported and accessible through GetLookupTable() 
+   // will be exported and accessible through GetLookupTable()
+   
    vtkSetMacro(AllowLookupTable, bool);
    vtkGetMacro(AllowLookupTable, bool);
    vtkBooleanMacro(AllowLookupTable, bool);
 
-
    vtkSetMacro(KeepOverlays, bool);
    vtkGetMacro(KeepOverlays, bool);
    vtkBooleanMacro(KeepOverlays, bool);
+   
+   vtkSetMacro(FlipY, bool);
+   vtkGetMacro(FlipY, bool);
+   vtkBooleanMacro(FlipY, bool);   
 
    vtkGetObjectMacro(LookupTable, vtkLookupTable);
 
@@ -187,6 +191,8 @@ private:
    
    bool KeepOverlays;
    
+   bool FlipY;
+   
    /// Pointer to a user suplied function to allow modification of pixel order
    VOID_FUNCTION_PUINT8_PFILE_POINTER UserFunction;
 
index 72dd2379a82a08dcbe4610dc2fdd8dc0365691ff..b840ea1cd471f390c95c2a7b3bac67deda703ce1 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmViewer2.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/10/03 15:50:13 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2009/04/18 14:42:51 $
+  Version:   $Revision: 1.16 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -129,6 +129,14 @@ int main(int argc, char *argv[])
       reader->SetKeepOverlays(true);
    }
 
+// not a very clever way to pass several params
+// but it's just for checking
+   if (strcmp (argv[argc-1], "n") == 0)
+   {
+      argc--; // Is it allowed?!?
+      reader->SetFlipY(false);
+   }
+
    if( argc == 2 )
       reader->SetFileName( argv[1] );
    else