]> Creatis software - gdcm.git/commitdiff
* vtk/vtkGdcm*.[h|cxx] : remove warnings. Add header to files
authorregrain <regrain>
Thu, 9 Dec 2004 10:59:59 +0000 (10:59 +0000)
committerregrain <regrain>
Thu, 9 Dec 2004 10:59:59 +0000 (10:59 +0000)
vtk/vtkGdcmReader.cxx
vtk/vtkGdcmReader.h
vtk/vtkGdcmWriter.cxx
vtk/vtkGdcmWriter.h

index cd4827d4a588c779b3bf8ee665a38485c0c6de56..91556c82e9803f3999f1f3decf2ee05f470c3d8e 100644 (file)
@@ -1,4 +1,21 @@
-// 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 
@@ -58,7 +75,7 @@
 #include <vtkPointData.h>
 #include <vtkLookupTable.h>
 
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.63 $");
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.64 $");
 vtkStandardNewMacro(vtkGdcmReader);
 
 //-----------------------------------------------------------------------------
index d3ca650a63cb679214c6b2b468e4e346cf6fd388..b04b56d9ed7a5ced9eb31442a9c0d993d7d751b4 100644 (file)
@@ -1,5 +1,21 @@
-// vtkGdcmReader.h
-//-----------------------------------------------------------------------------
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: vtkGdcmReader.h,v $
+  Language:  C++
+  Date:      $Date: 2004/12/09 10:59:59 $
+  Version:   $Revision: 1.20 $
+                                                                                
+  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.
+                                                                                
+=========================================================================*/
+                                                                                
 #ifndef __vtkGdcmReader_h
 #define __vtkGdcmReader_h
 
index a7ca870e9768dc3693d979304b8f566ece420618..c104c2a269a45bb4674103c592b47d9b91932dd7 100644 (file)
@@ -1,53 +1,21 @@
-// vtkGdcmWriter.cxx
-//-----------------------------------------------------------------------------
-// //////////////////////////////////////////////////////////////
-// WARNING TODO CLEANME 
-// Actual limitations of this code:
-//
-// /////// Redundant and unnecessary header parsing
-// In it's current state this code actually parses three times the Dicom
-// header of a file before the corresponding image gets loaded in the
-// ad-hoc vtkData !
-// Here is the process:
-//  1/ First loading happens in ExecuteInformation which in order to
-//     positionate the vtk extents calls CheckFileCoherence. The purpose
-//     of CheckFileCoherence is to make sure all the images in the future
-//     stack are "homogenous" (same size, same representation...). This
-//     can only be achieved by parsing all the Dicom headers...
-//  2/ ExecuteData is then responsible for the next two loadings:
-//  2a/ ExecuteData calls AllocateOutputData that in turn seems to 
-//      (indirectely call) ExecuteInformation which ends up in a second
-//      header parsing
-//      This is fixed by adding a test at the beginning of ExecuteInformation
-//      on the modification of the object instance. If a modification have been
-//      made (method Modified() ), the MTime value is increased. The fileTime
-//      is compared to this new value to find a modification in the class
-//      parameters
-//  2b/ the core of ExecuteData then needs gdcmFile (which in turns
-//      initialises gdcmHeader in the constructor) in order to access
-//      the data-image.
-//
-// Possible solution:
-// maintain a list of gdcmFiles (created by say ExecuteInformation) created
-// once and for all accross the life of vtkGdcmHeader (it would only load
-// new gdcmFile if the user changes the list). ExecuteData would then use 
-// those gdcmFile and hence avoid calling the construtor:
-//  - advantage: the header of the files would only be parser once.
-//  - drawback: once execute information is called (i.e. on creation of
-//              a vtkGdcmHeader) the gdcmFile structure is loaded in memory.
-//              The average size of a gdcmHeader being of 100Ko, is one
-//              loads 10 stacks of images with say 200 images each, you
-//              end-up with a loss of 200Mo...
-//
-// /////// Never unallocated memory:
-// ExecuteData allocates space for the pixel data [which will get pointed
-// by the vtkPointData() through the call
-// data->GetPointData()->GetScalars()->SetVoidArray(mem, StackNumPixels, 0);]
-// This data is never "freed" neither in the destructor nor when the
-// filename list is extended, ExecuteData is called a second (or third)
-// time...
-// //////////////////////////////////////////////////////////////
-
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: vtkGdcmWriter.cxx,v $
+  Language:  C++
+  Date:      $Date: 2004/12/09 10:59:59 $
+  Version:   $Revision: 1.4 $
+                                                                                
+  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.
+                                                                                
+=========================================================================*/
+                                                                                
 #include "gdcmHeader.h"
 #include "gdcmFile.h"
 #include "gdcmDebug.h"
@@ -58,7 +26,7 @@
 #include <vtkPointData.h>
 #include <vtkLookupTable.h>
 
-vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.3 $");
+vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.4 $");
 vtkStandardNewMacro(vtkGdcmWriter);
 
 //-----------------------------------------------------------------------------
@@ -212,6 +180,7 @@ void SetImageInformation(gdcm::File *file,vtkImageData *image)
  */ 
 void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *image, ofstream *file)
 {
+   (void)axis; // To avoid warning
    if(file)
    {
       vtkErrorMacro(<< "File musn't be opened");
@@ -227,10 +196,19 @@ void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *image, ofstream *file
       return;
    }
 
-   WriteFile(this->FileName,image);
+   WriteDcmFile(this->FileName,image);
+}
+
+void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *image, 
+                                   vtkImageData *cache, ofstream *file)
+{
+   (void)axis; // To avoid warning
+   (void)image; // To avoid warning
+   (void)cache; // To avoid warning
+   (void)file; // To avoid warning
 }
 
-void vtkGdcmWriter::WriteFile(char *fileName,vtkImageData *image)
+void vtkGdcmWriter::WriteDcmFile(char *fileName,vtkImageData *image)
 {
    // From here, the write of the file begins
    gdcm::File *dcmFile = new gdcm::File();
@@ -239,7 +217,7 @@ void vtkGdcmWriter::WriteFile(char *fileName,vtkImageData *image)
    SetImageInformation(dcmFile,image);
 
    // Write the image
-   if(!dcmFile->Write(FileName))
+   if(!dcmFile->Write(fileName))
    {
       vtkErrorMacro(<< "File " << this->FileName << "couldn't be written by "
                     << " the gdcm library");
index ff255b2b079fdfa36ff0b3004a3392f6e8b6184e..79e8edb8f1e55d2abd63f57eefb48553c563db8d 100644 (file)
@@ -1,5 +1,21 @@
-// vtkGdcmWriter.h
-//-----------------------------------------------------------------------------
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: vtkGdcmWriter.h,v $
+  Language:  C++
+  Date:      $Date: 2004/12/09 10:59:59 $
+  Version:   $Revision: 1.3 $
+                                                                                
+  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.
+                                                                                
+=========================================================================*/
+                                                                                
 #ifndef __vtkGdcmWriter_h
 #define __vtkGdcmWriter_h
 
@@ -27,7 +43,9 @@ protected:
    ~vtkGdcmWriter();
 
   virtual void RecursiveWrite(int axis, vtkImageData *image, ofstream *file);
-  void WriteFile(char *fileName,vtkImageData *image);
+  virtual void RecursiveWrite(int axis, vtkImageData *image, 
+                              vtkImageData *cache, ofstream *file);
+  void WriteDcmFile(char *fileName,vtkImageData *image);
 
 private:
 // Variables