]> Creatis software - gdcm.git/commitdiff
*** empty log message ***
authorjpr <jpr>
Fri, 17 Mar 2006 14:46:17 +0000 (14:46 +0000)
committerjpr <jpr>
Fri, 17 Mar 2006 14:46:17 +0000 (14:46 +0000)
vtk/CMakeLists.txt
vtk/vtkGdcmReader.h
vtk/vtkGdcmWriter.cxx
vtk/vtkGdcmWriter.h
vtk/vtkgdcmViewer2.cxx

index a0c5d334de0504f18e2f619dc98bc4fc0b6b905a..72f1b0cde3530656a9ad0123ef9915910edd3bf8 100644 (file)
@@ -78,17 +78,27 @@ TARGET_LINK_LIBRARIES(vtkgdcmSerieViewer2
   vtkgdcm
   vtkRendering
 )
+
+
 #-----------------------------------------------------------------------------
 SET(vtkWriteDicom_SOURCES
   vtkWriteDicom.cxx
 )
+SET(vtkWriteDicomExtended_SOURCES
+  vtkWriteDicomExtended.cxx  
+)
 ADD_EXECUTABLE(vtkWriteDicom ${vtkWriteDicom_SOURCES})
 TARGET_LINK_LIBRARIES(vtkWriteDicom
   vtkgdcm
   vtkIO
   vtkRendering
 )
-
+ADD_EXECUTABLE(vtkWriteDicomExtended ${vtkWriteDicomExtended_SOURCES})
+TARGET_LINK_LIBRARIES(vtkWriteDicomExtended
+  vtkgdcm
+  vtkIO
+  vtkRendering
+)
 #-----------------------------------------------------------------------------
 # Install vtk header
 INSTALL_FILES(/include/gdcm FILES vtkGdcmReader.h)
index b747f9490c03b091a892f2d8b7ca24bb38b7861b..39b546ac268a197799a157d182d113d83083e5e9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkGdcmReader.h,v $
   Language:  C++
-  Date:      $Date: 2005/08/31 15:54:51 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2006/03/17 14:46:17 $
+  Version:   $Revision: 1.30 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -68,7 +68,7 @@ public:
 
    vtkGetObjectMacro(LookupTable, vtkLookupTable);
 
-// FIXME : HOW to doxygen a VTM macro?
+// FIXME : HOW to doxygen a VTK macro?
 /*
  * \ brief Sets the LoadMode as a boolean string. 
  *        gdcm.LD_NOSEQ, gdcm.LD_NOSHADOW, gdcm.LD_NOSHADOWSEQ... 
index 333be8f232ba5e4be1a472528bd1319ae05c8cf3..15f548c2952febb359679898ce54a1b74ba40d1a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkGdcmWriter.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/25 14:52:37 $
-  Version:   $Revision: 1.26 $
+  Date:      $Date: 2006/03/17 14:46:18 $
+  Version:   $Revision: 1.27 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -31,7 +31,7 @@
 #define vtkFloatingPointType float
 #endif
 
-vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.26 $")
+vtkCxxRevisionMacro(vtkGdcmWriter, "$Revision: 1.27 $")
 vtkStandardNewMacro(vtkGdcmWriter)
 
 //-----------------------------------------------------------------------------
@@ -41,6 +41,8 @@ vtkGdcmWriter::vtkGdcmWriter()
    this->LookupTable = NULL;
    this->FileDimensionality = 3;
    this->WriteType = VTK_GDCM_WRITE_TYPE_EXPLICIT_VR;
+   this->GdcmFile = 0;
+   this->ContentType = VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE;
 }
 
 vtkGdcmWriter::~vtkGdcmWriter()
@@ -244,8 +246,8 @@ void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *image,
        image->GetScalarType() == VTK_DOUBLE )
    {
       vtkErrorMacro(<< "Bad input type. Scalar type must not be of type "
-                    << "VTK_FLOAT or VTKDOUBLE (found:"
-                    << image->GetScalarTypeAsString());
+                    << "VTK_FLOAT or VTK_DOUBLE (found:"
+                    << image->GetScalarTypeAsString() << ")" );
       return;
    }
 
@@ -331,9 +333,14 @@ void vtkGdcmWriter::RecursiveWrite(int axis, vtkImageData *cache,
 
 void vtkGdcmWriter::WriteDcmFile(char *fileName, vtkImageData *image)
 {
+   gdcm::FileHelper *dcmFile;
+   if ( GdcmFile != 0)
+      dcmFile = gdcm::FileHelper::New(GdcmFile);
+   else
+      dcmFile = gdcm::FileHelper::New();
+   
    // From here, the write of the file begins
-   gdcm::FileHelper *dcmFile = gdcm::FileHelper::New();
-
+   
    // Set the image informations
    SetImageInformation(dcmFile, image);
 
index f5b18e9715b54c3e1d0487ae0d29b8c5165ed7cf..548f8195fdc9a187a6d804332a6ace8baaf6d28b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkGdcmWriter.h,v $
   Language:  C++
-  Date:      $Date: 2005/03/03 11:39:24 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2006/03/17 14:46:18 $
+  Version:   $Revision: 1.7 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 #define __vtkGdcmWriter_h
 
 #include "gdcmCommon.h" // To avoid warnings concerning the std
+#include "gdcmFile.h"   // for gdcm::File
 
 #include <vtkImageWriter.h>
 #include <vtkLookupTable.h>
 #include <string>
 
 //-----------------------------------------------------------------------------
+
 #define VTK_GDCM_WRITE_TYPE_EXPLICIT_VR 1
 #define VTK_GDCM_WRITE_TYPE_IMPLICIT_VR 2
 #define VTK_GDCM_WRITE_TYPE_ACR         3
 #define VTK_GDCM_WRITE_TYPE_ACR_LIBIDO  4
 
+#define VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE          1
+#define VTK_GDCM_WRITE_TYPE_FILTERED_IMAGE          2
+#define VTK_GDCM_WRITE_TYPE_CREATED_IMAGE           3
+#define VTK_GDCM_WRITE_TYPE_UNMODIFIED_PIXELS_IMAGE 4
+
 //-----------------------------------------------------------------------------
 class VTK_EXPORT vtkGdcmWriter : public vtkImageWriter
 {
@@ -47,10 +54,25 @@ public:
    void SetWriteTypeToDcmExplVR(){SetWriteType(VTK_GDCM_WRITE_TYPE_IMPLICIT_VR);};
    void SetWriteTypeToAcr()      {SetWriteType(VTK_GDCM_WRITE_TYPE_ACR);        };
    void SetWriteTypeToAcrLibido(){SetWriteType(VTK_GDCM_WRITE_TYPE_ACR_LIBIDO); };
+   
+   void SetContentTypeToUserOwnImage()         {SetContentType(VTK_GDCM_WRITE_TYPE_USER_OWN_IMAGE);};   
+   void SetContentTypeToFilteredImage()        {SetContentType(VTK_GDCM_WRITE_TYPE_FILTERED_IMAGE);};   
+   void SetContentTypeToUserCreatedImage()     {SetContentType(VTK_GDCM_WRITE_TYPE_CREATED_IMAGE);};   
+   void SetContentTypeToUnmodifiedPixelsImage(){SetContentType(VTK_GDCM_WRITE_TYPE_UNMODIFIED_PIXELS_IMAGE);};   
+   
    vtkSetMacro(WriteType, int);
    vtkGetMacro(WriteType, int);
    const char *GetWriteTypeAsString();
 
+//BTX
+   vtkSetMacro(GdcmFile, gdcm::File *);
+   vtkGetMacro(GdcmFile, gdcm::File *);
+//ETX
+
+   vtkSetMacro(ContentType, int);
+   vtkGetMacro(ContentType, int);
+
+     
 protected:
    vtkGdcmWriter();
    ~vtkGdcmWriter();
@@ -64,6 +86,11 @@ private:
 // Variables
    vtkLookupTable *LookupTable;
    int WriteType;
+//BTX
+   gdcm::File *GdcmFile;
+//ETX
+   int ContentType;
+   
 };
 
 //-----------------------------------------------------------------------------
index 4c499166ebc8247c6d01f2b0cde698558ea5939c..ccac0d7c16ef68a8c8f2568845337cad84724d28 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmViewer2.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/08/30 15:13:10 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2006/03/17 14:46:18 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -117,6 +117,12 @@ int main(int argc, char *argv[])
    }
    else
    {
+   
+   // For a single medical image, it would be more efficient to use
+   // 0028|1050 [DS] [Window Center]
+   // 0028|1051 [DS] [Window Width]
+   // but vtkgdcmReader doesn't know about them :-(
+
       vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange();
       viewer->SetColorLevel (0.5 * (range[1] + range[0]));
       viewer->SetColorWindow (range[1] - range[0]);