[clitk-commits-list] Clitk branch master updated. v1.2.0-609-gde73c67

root root at tux.creatis.insa-lyon.fr
Tue Dec 20 18:27:44 CET 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Clitk".

The branch, master has been updated
       via  de73c67818eb9bb316269a5db3d5a32d91a92fa5 (commit)
       via  1a59b22f9105492f15d971d66f3ab29981e91ed6 (commit)
      from  f54492f7ac7d30e35ad953fe9f8c485bbb98c36d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.creatis.insa-lyon.fr/pubgit/?p=clitk.git;a=commitdiff;h=de73c67818eb9bb316269a5db3d5a32d91a92fa5

commit de73c67818eb9bb316269a5db3d5a32d91a92fa5
Author: Romulo Pinho <romulo.pinho at lyon.unicancer.fr>
Date:   Tue Dec 20 18:24:36 2011 +0100

    --focal_origin works again

diff --git a/tools/clitkDicom2Image.cxx b/tools/clitkDicom2Image.cxx
index b13de42..0ad79ef 100644
--- a/tools/clitkDicom2Image.cxx
+++ b/tools/clitkDicom2Image.cxx
@@ -23,6 +23,7 @@
 #include "vvImageReader.h"
 #include "vvImageWriter.h"
 #include <gdcmFile.h>
+#include <vtkImageChangeInformation.h>
 #if GDCM_MAJOR_VERSION == 2
   #include <gdcmImageHelper.h>
   #include <gdcmAttribute.h>
@@ -51,6 +52,7 @@ int main(int argc, char * argv[])
 
   //===========================================
   /// Get slices locations ...
+  std::vector<double> theorigin(3);
   std::vector<double> sliceLocations;
   for(unsigned int i=0; i<args_info.inputs_num; i++) {
     //std::cout << "Reading <" << input_files[i] << std::endl;
@@ -58,7 +60,7 @@ int main(int argc, char * argv[])
     gdcm::Reader hreader;
     hreader.SetFileName(input_files[i].c_str());
     hreader.Read();
-    std::vector<double> theorigin = gdcm::ImageHelper::GetOriginValue(hreader.GetFile());
+    theorigin = gdcm::ImageHelper::GetOriginValue(hreader.GetFile());
     sliceLocations.push_back(theorigin[2]);
     gdcm::Attribute<0x28, 0x100> pixel_size;
     gdcm::DataSet& ds = hreader.GetFile().GetDataSet();
@@ -74,7 +76,10 @@ int main(int argc, char * argv[])
   header->SetFileName(input_files[i]);
   header->SetMaxSizeLoadEntry(16384); // required ?
   header->Load();
-  sliceLocations.push_back(header->GetZOrigin());
+  theorigin[0] = header->GetXOrigin();
+  theorigin[1] = header->GetYOrigin();
+  theorigin[2] = header->GetZOrigin();
+  sliceLocations.push_back(theorigin[2]);
   if (header->GetPixelSize() != 2) {
     std::cerr << "Pixel type 2 bytes ! " << std::endl;
     std::cerr << "In file " << input_files[i] << std::endl;
@@ -143,11 +148,29 @@ int main(int argc, char * argv[])
     std::cerr << reader->GetLastError() << std::endl;
     return 1;
   }
+  
+  vvImage::Pointer image = reader->GetOutput();
+  vtkImageData* vtk_image = image->GetFirstVTKImageData();
+  vtkImageChangeInformation* modifier = vtkImageChangeInformation::New();
+  if  (args_info.focal_origin_given) {
+    std::vector<double> spacing = image->GetSpacing();
+    std::vector<int> size = image->GetSize();
+    theorigin[0] = -spacing[0]*size[0]/2.0;
+    theorigin[1] = -spacing[1]*size[1]/2.0;
+    modifier->SetInput(vtk_image);
+    modifier->SetOutputOrigin(theorigin[0], theorigin[1], theorigin[2]);
+    modifier->Update();
+    vvImage::Pointer focal_image = vvImage::New();
+    focal_image->AddVtkImage(modifier->GetOutput());
+    image = focal_image;
+  }
 
   vvImageWriter::Pointer writer = vvImageWriter::New();
-  writer->SetInput(reader->GetOutput());
+  writer->SetInput(image);
   writer->SetOutputFileName(args_info.output_arg);
   writer->Update();
 
+  modifier->Delete();
+
   return 0;
 }

http://git.creatis.insa-lyon.fr/pubgit/?p=clitk.git;a=commitdiff;h=1a59b22f9105492f15d971d66f3ab29981e91ed6

commit 1a59b22f9105492f15d971d66f3ab29981e91ed6
Author: Romulo Pinho <romulo.pinho at lyon.unicancer.fr>
Date:   Tue Dec 20 18:24:01 2011 +0100

    Possibility to add a VTK image to vvImage

diff --git a/common/vvImage.cxx b/common/vvImage.cxx
index 9a6fc8f..0bddb26 100644
--- a/common/vvImage.cxx
+++ b/common/vvImage.cxx
@@ -64,6 +64,27 @@ void vvImage::Reset()
 //--------------------------------------------------------------------
 
 //--------------------------------------------------------------------
+void vvImage::AddVtkImage(vtkImageData* input)
+{
+  // RP: 20/12/2011
+  // Note that we're simply adding a new image to the vector.
+  // mItkToVtkConverters is therefore not being updated, but 
+  // up to here it's not being used anyway...
+  mImageDimension = 0;
+  int* extent = input->GetWholeExtent();
+  if (extent[4] != extent[5])
+    mImageDimension = 3;
+  else if (extent[3] != extent[4])
+    mImageDimension = 2;
+  else if (extent[0] != extent[1])
+    mImageDimension = 1;
+  
+  mVtkImages.push_back(input);
+}
+
+//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
 int vvImage::GetNumberOfSpatialDimensions()
 {
   return mImageDimension;
diff --git a/common/vvImage.h b/common/vvImage.h
index e48dbfa..ec01a1f 100644
--- a/common/vvImage.h
+++ b/common/vvImage.h
@@ -40,6 +40,7 @@ public :
   void Init();
   void Reset();
   template<class TItkImageType> void AddItkImage(TItkImageType *input);
+  void AddVtkImage(vtkImageData* input);
   const std::vector<vtkImageData*>& GetVTKImages();
   vtkImageData* GetFirstVTKImageData();
   int GetNumberOfDimensions() const;

-----------------------------------------------------------------------

Summary of changes:
 common/vvImage.cxx         |   21 +++++++++++++++++++++
 common/vvImage.h           |    1 +
 tools/clitkDicom2Image.cxx |   29 ++++++++++++++++++++++++++---
 3 files changed, 48 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Clitk


More information about the Clitk-commits-list mailing list