]> Creatis software - clitk.git/blobdiff - tools/clitkProfileImageGenericFilter.cxx
Add wipe tool
[clitk.git] / tools / clitkProfileImageGenericFilter.cxx
index 1eb58c28ffd93f95775ff3a5d2b8d9eb3fb14923..02394d3ca60231943e534a5d036dcf0911cd224a 100644 (file)
@@ -31,6 +31,7 @@
 
 // itk include
 #include <itkLineIterator.h>
+#include <itkPoint.h>
 
 #include <clitkCommon.h>
 
@@ -120,6 +121,13 @@ ProfileImageGenericFilter::UpdateWithInputImageType()
   mCoord = vtkSmartPointer<vtkFloatArray>::New();
   mCoord->SetNumberOfComponents(InputImageType::ImageDimension);
   
+  /*typename InputImageType::Pointer outputImage;
+  outputImage = InputImageType::New();
+  outputImage->SetRegions(input->GetLargestPossibleRegion());
+  outputImage->Allocate();
+  outputImage->FillBuffer(0); */
+  
   //Iterator
   IndexType pointBegin, pointEnd;
   
@@ -132,23 +140,45 @@ ProfileImageGenericFilter::UpdateWithInputImageType()
   itProfile.GoToBegin();
   int lineNumber(1);
   double *tuple;
+  double distance;
   tuple = new double[InputImageType::ImageDimension];
+  itk::Point<double, InputImageType::ImageDimension> transformedFirstPoint;
+  itk::Point<double, InputImageType::ImageDimension> transformedCurrentPoint;
+  
+  input->TransformIndexToPhysicalPoint(itProfile.GetIndex(), transformedFirstPoint);
   
   while (!itProfile.IsAtEnd())
   {    
-    // Fill in the table
-    mArrayX->InsertNextTuple1(lineNumber);
+    // Fill in the table the intensity value
     mArrayY->InsertNextTuple1(itProfile.Get());
         
     for (int i=0; i<InputImageType::ImageDimension; ++i) {
         tuple[i] = itProfile.GetIndex()[i];
     }
+
+    input->TransformIndexToPhysicalPoint(itProfile.GetIndex(), transformedCurrentPoint);
+    distance = transformedFirstPoint.EuclideanDistanceTo(transformedCurrentPoint);
+
+    // Fill in the table the distance value
+    mArrayX->InsertNextTuple1(distance);
     
+    // Fille in the table the voxel coordinate value
     mCoord->InsertNextTuple(tuple);
     ++lineNumber;
     ++itProfile;
   }
   
+  /*
+  itk::LineIterator<InputImageType> otProfile(outputImage, pointBegin, pointEnd);
+  otProfile.GoToBegin();  
+  while (!otProfile.IsAtEnd())
+  {    
+    otProfile.Set(1.0);
+    ++otProfile;
+  }
+  
+  this->template SetNextOutput<InputImageType>(outputImage): */
+  
   delete [] tuple;
 }
 //--------------------------------------------------------------------