]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Wed, 24 Jun 2015 08:50:44 +0000 (10:50 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Wed, 24 Jun 2015 08:50:44 +0000 (10:50 +0200)
14 files changed:
cluster_tools/gate_job_ccin2p3.job
cluster_tools/gate_run_submit_cluster.sh
cluster_tools/mergeStatFile.py
common/clitkCommon.h
common/clitkDD.h
common/clitkTimer.cxx
common/rtkImagXImageIO.cxx
registration/clitkMatrixTransformToVFGenericFilter.txx
tools/clitkAffineTransform.ggo
tools/clitkAffineTransformGenericFilter.txx
tools/clitkGammaIndex.cxx
tools/clitkImageStatisticsGenericFilter.txx
tools/clitkPadImageGenericFilter.cxx
tools/clitkPadImageGenericFilter.h

index b4fbe62d4ab64c8cb525ddf241acdfb53a343bf8..e4437808c250c5ca32aa46849860bda8416a4460 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash -x
+#! /usr/local/bin/bash -lx
 #
 # MACRODIR
 # MACROFILE
@@ -92,11 +92,13 @@ else
        || error "gate failed"
 fi
 
+date
 echo "Copying data back"
 ssh -i ${HOME}/.ssh/ccin2p3 linux1.dg.creatis.insa-lyon.fr "mkdir cc/$(basename ${OUTPUTDIR})/output.${JOB_ID%%.*}"
 rsync -av --remove-source-files -e "ssh -i ${HOME}/.ssh/ccin2p3" output/ "linux1.dg.creatis.insa-lyon.fr:./cc/$(basename ${OUTPUTDIR})/output.${JOB_ID%%.*}"
 
 echo "Cleanup"
 rm -r ${LOCALMACRODIR}
+date
 
 echo "Success!!!"
index 29427bd8cf93b7d937bf01ac68e7e22b6b293dfa..91120500e4ae817ff51e0ef958125c0843a0ba87 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/local/bin/bash -lx
 
 set -u
 SCRIPTNAME="$(basename "${0}")"
index a1cd573cdb21e5f23488992c401d029a74d6b17a..ab5028954ce62feeab9953d0baf3af6dc0eb4f49 100755 (executable)
@@ -27,7 +27,9 @@ def parse_stat_file(filename):
     keys = {}
     for line in open(filename,"r").readlines():
         match = linere.match(line)
-        assert(match is not None)
+        #assert(match is not None)
+        if match is None:
+            continue
         groups = match.groups()
         if groups[0] not in mergedlines:
             continue
@@ -88,4 +90,3 @@ jkeys = parse_stat_file(sys.argv[4])
 keys  = merge_keys(ikeys,jkeys)
 output = format_keys(keys)
 open(sys.argv[6],"w").write(output)
-
index 2f5b26f1173b3e5e94999816031695c13cb2afc4..b58974a3e721c486e6ff164f7ff2f18d25a25673 100644 (file)
@@ -1,7 +1,7 @@
 /*=========================================================================
   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
 
-  Authors belong to: 
+  Authors belong to:
   - University of LYON              http://www.universite-lyon.fr/
   - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
@@ -34,7 +34,7 @@
 #include <fstream>
 
 // Include for "rusage"
-#include <ctime> 
+#include <ctime>
 #if defined(unix) || defined(__APPLE__)
 #  include <sys/time.h>
 #  include <sys/resource.h>
@@ -51,7 +51,7 @@ namespace clitk {
   typedef unsigned char uchar;
   typedef unsigned short ushort;
   typedef unsigned int uint;
-  
+
 #define CLITK_TRY_CATCH_EXIT(func) \
   try { \
     func; \
@@ -68,13 +68,13 @@ namespace clitk {
     std::cout << "Unknown excpetion" << std::endl; \
     exit(-3); \
   }
-    
+
 
   //--------------------------------------------------------------------
   // when everything goes wrong
 #define WHEREAMI "[ " << __FILE__  << " ] line " << __LINE__
-#define FATAL(a) std::cerr << "ERROR in " << WHEREAMI << ": " << a; exit(0);
-  
+#define FATAL(a) { std::cerr << "ERROR in " << WHEREAMI << ": " << a; exit(0); }
+
   //--------------------------------------------------------------------
   // GGO with modified struct name
 #define GGO(ggo_filename, args_info)                                    \
@@ -82,7 +82,7 @@ namespace clitk {
   cmdline_parser_##ggo_filename##2(argc, argv, &args_info, 1, 1, 0);                   \
   if (args_info.config_given)                                          \
     cmdline_parser_##ggo_filename##_configfile (args_info.config_arg, &args_info, 0, 0, 1); \
-  else cmdline_parser_##ggo_filename(argc, argv, &args_info);  
+  else cmdline_parser_##ggo_filename(argc, argv, &args_info);
 
   //--------------------------------------------------------------------
   // skip line with #
@@ -95,15 +95,15 @@ namespace clitk {
   //--------------------------------------------------------------------
   // Return filename extension
   std::string GetExtension(const std::string& filename);
-  
+
   //--------------------------------------------------------------------
   // Convert float, double ... to string
   template<class T> std::string toString(const T & t);
   template<class T> std::string toStringVector(const T * t, const int n);
   template<class T> std::string toStringVector(const T & t, const int n);
   template<class T> std::string toStringVector(const std::vector<T> & t);
-  template <class T> bool fromString(T& t, 
-                                     const std::string& s, 
+  template <class T> bool fromString(T& t,
+                                     const std::string& s,
                                      std::ios_base& (*f)(std::ios_base&)=std::dec);
 
   //--------------------------------------------------------------------
@@ -129,7 +129,7 @@ namespace clitk {
   // Return the name of a type as a string
   template<class TPixel>
   std::string GetTypeAsString();
-  
+
   //--------------------------------------------------------------------
   // Convert radian / degree
   double rad2deg(double anglerad);
@@ -152,13 +152,13 @@ namespace clitk {
   std::string CreateListOfTypes(bool last=true) {
     return GetTypeAsString<T1>();
   }
-  
+
   template<class T1, class T2>
   std::string CreateListOfTypes(bool last=true) {
     if (last) return CreateListOfTypes<T1>()+" and "+CreateListOfTypes<T2>();
     else return CreateListOfTypes<T1>()+", "+CreateListOfTypes<T2>();
   }
-  
+
   template<class T1, class T2, class T3>
   std::string CreateListOfTypes(bool last=true) {
     if (last) return CreateListOfTypes<T1,T2>(false)+" and "+CreateListOfTypes<T3>();
@@ -195,7 +195,7 @@ namespace clitk {
     else return CreateListOfTypes<T1,T2,T3,T4,T5,T6,T7>(false)+", "+CreateListOfTypes<T8>();
   }
   //--------------------------------------------------------------------
-  
+
   //--------------------------------------------------------------------
   void FindAndReplace(std::string & line, const std::string & tofind, const std::string & replacement);
   void FindAndReplace(std::string & line, const std::vector<std::string> & tofind, const std::vector<std::string> & toreplace);
@@ -203,8 +203,8 @@ namespace clitk {
   //--------------------------------------------------------------------
 
   //--------------------------------------------------------------------
-  double ComputeEuclideanDistanceFromPointToPlane(const itk::ContinuousIndex<double, 3> point, 
-                                                 const itk::ContinuousIndex<double, 3> pointInPlane, 
+  double ComputeEuclideanDistanceFromPointToPlane(const itk::ContinuousIndex<double, 3> point,
+                                                 const itk::ContinuousIndex<double, 3> pointInPlane,
                                                  const itk::ContinuousIndex<double, 3> normalPlane);
 
   //--------------------------------------------------------------------
@@ -232,9 +232,9 @@ namespace clitk {
 
   //--------------------------------------------------------------------
   // Convert a map to a vector
-  template <typename M, typename V> 
+  template <typename M, typename V>
   void MapToVecFirst(const M & m, V & v);
-  template <typename M, typename V> 
+  template <typename M, typename V>
   void MapToVecSecond(const M & m, V & v);
 
   //--------------------------------------------------------------------
@@ -247,4 +247,3 @@ namespace clitk {
 } // end namespace
 
 #endif /* end #define CLITKCOMMON_H */
-
index 97ba4437b07e5f5207faf55bfee180ac63f1cd2b..c5a999629358e06be28d4f6232f047d8dc4f909c 100644 (file)
@@ -38,6 +38,6 @@
   template<class T>
     void _print_container(T const& a)
     { for(typename T::const_iterator i=a.begin();i!=a.end();++i) { std::cout << *i << " "; };}
-#define DDS(a) { std::cout << #a " = [ "; _print_container(a) ; std::cout << " ]" << std::endl;std::cout.flush():}
+#define DDS(a) { std::cout << #a " = [ "; _print_container(a) ; std::cout << " ]" << std::endl;std::cout.flush();}
 
 #endif
index cd74428832f4505df7edd11028b359030ab064c5..329ca13f04272d44104a3f0926e54e3b0e5b0aa8 100644 (file)
@@ -64,13 +64,15 @@ void clitk::Timer::Stop(bool accumulate)
     mElapsed += (mEnd.ru_utime.tv_usec - mBegin.ru_utime.tv_usec)+
                 (mEnd.ru_utime.tv_sec - mBegin.ru_utime.tv_sec)*1000000;
   }
+  else
 #elif defined(_WIN32)
   QueryPerformanceCounter((LARGE_INTEGER*)&mEnd);
   if (accumulate) {
     mElapsed += ((mEnd-mBegin)*1000000)/(long double)mFrequency;
   }
+  else
 #endif
-  else {
+  {
     mNumberOfCall--;
   }
 }
@@ -114,4 +116,3 @@ void clitk::Timer::Reset()
 
 // #endif // If UNIX
 #endif /* end #define CLITKTIMER_CXX */
-
index d197ed7d122c9a702befd5b0fd33bac2cd14a8fc..09cb910558dc9e9eabedfb81be6c23b0bee42bef 100644 (file)
@@ -57,7 +57,7 @@ void rtk::ImagXImageIO::ReadImageInformation()
   if(pixelType=="Type_float")
     SetComponentType(itk::ImageIOBase::FLOAT);
 
-  if(dic["dimensions"].GetPointer()==NULL)
+  if( dic["dimensions"].GetPointer() == NULL )
     SetNumberOfDimensions(3);
   else
     SetNumberOfDimensions( ( dynamic_cast<MetaDataIntType *>(dic["dimensions"].GetPointer() )->GetMetaDataObjectValue() ) );
@@ -73,15 +73,22 @@ void rtk::ImagXImageIO::ReadImageInformation()
     {
     SetDimensions(2, dynamic_cast<MetaDataIntType *>(dic["z"].GetPointer() )->GetMetaDataObjectValue() );
     SetSpacing(2, dynamic_cast<MetaDataDoubleType *>(dic["spacing_z"].GetPointer() )->GetMetaDataObjectValue() );
+    if(GetSpacing(2) == 0)
+      SetSpacing(2, 1);
     }
 
-  std::istringstream iss(
-    dynamic_cast<MetaDataStringType*>(dic["matrixTransform"].GetPointer() )->GetMetaDataObjectValue() );
   itk::Matrix<double, 4, 4> matrix;
-  for(unsigned int j=0; j<4; j++)
-    for(unsigned int i=0; i<4; i++)
-      iss >> matrix[j][i];
-  matrix /= matrix[3][3];
+  if(dic["matrixTransform"].GetPointer() == NULL)
+    matrix.SetIdentity();
+  else
+    {
+    std::istringstream iss(
+      dynamic_cast<MetaDataStringType*>(dic["matrixTransform"].GetPointer() )->GetMetaDataObjectValue() );
+    for(unsigned int j=0; j<4; j++)
+      for(unsigned int i=0; i<4; i++)
+        iss >> matrix[j][i];
+    matrix /= matrix[3][3];
+    }
 
   std::vector<double> direction;
   for(unsigned int i=0; i<GetNumberOfDimensions(); i++)
@@ -173,20 +180,19 @@ void rtk::ImagXImageIO::Read(void * buffer)
 
 //--------------------------------------------------------------------
 // Write Image Information
-void rtk::ImagXImageIO::WriteImageInformation(bool keepOfStream)
+void rtk::ImagXImageIO::WriteImageInformation( bool itkNotUsed(keepOfStream) )
 {
 }
 
 //--------------------------------------------------------------------
 // Write Image Information
-bool rtk::ImagXImageIO::CanWriteFile(const char* FileNameToWrite)
+bool rtk::ImagXImageIO::CanWriteFile( const char* itkNotUsed(FileNameToWrite) )
 {
   return false;
 }
 
 //--------------------------------------------------------------------
 // Write Image
-void rtk::ImagXImageIO::Write(const void * buffer)
+void rtk::ImagXImageIO::Write( const void * itkNotUsed(buffer) )
 {
 } ////
-
index d864900c0cc0d37a6d299d000634300fe818717c..a1241b5358cc06a0ab63065be57a2f41134c0bfe 100644 (file)
@@ -101,6 +101,7 @@ namespace clitk
        typename OutputImageType::Pointer image=reader2->GetOutput();
 #if ITK_VERSION_MAJOR > 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR >= 6)
     filter->SetReferenceImage(image);
+    filter->UseReferenceImageOn();
 #else
     filter->SetOutputParametersFromImage(image);
 #endif
index ead649ff4eb809b5e5789023921685b72257fb65..bb74448cead8ee4624a9087bd5958ecdaa3e29d5 100644 (file)
@@ -3,33 +3,33 @@ package "clitkAffineTransform"
 version "1.0"
 purpose "Resample with or without affine transform of 2D, 3D, 4D images or vector fields"
 
-option "config"                -       "Config file"                     string        no
-option "verbose"       v       "Verbose"                         flag          off
+option "config"                - "Config file"                   string        no
+option "verbose"       v "Verbose"                       flag          off
 
 section "I/O"
-option "input"         i       "Input image filename"            string        yes
-option "output"        o       "Output image filename"           string        yes
-option "like"          l       "Resample output this image (size, spacing,origin)"     string  no
-option "transform_grid" -       "Apply affine transform to input grid for output's"     flag    off
+option "input"         i "Input image filename"                                          string yes
+option "output"        o "Output image filename"                                         string yes
+option "like"          l "Resample output this image (size, spacing, origin, direction)" string no
+option "transform_grid" - "Apply affine transform to input grid for output's"             flag   off
 
 section "Options"
-option "size"          -       "New output size if different from input"       int     no      multiple
-option "spacing"       -       "New output spacing if different from input"    double  no      multiple
-option "spacinglike"   -       "New output spacing like this image"            string  no
-option "origin"                -       "New output origin if different from input"     double  no      multiple
-option "matrix"                m       "Affine matrix (homogene) filename"             string  no
-option "elastix"       e       "Read EulerTransform from elastix output file (combine if multiple)"    string  no
-option "rotate"                r       "Rotation to apply (radians)"                   double  no      multiple
-option "translate"     t       "Translation to apply (mm)"                     double  no      multiple
-option "pad"           -       "Edge padding value"                            double  no      default="0.0"
+option "size"          - "New output size if different from input"     int     no      multiple
+option "spacing"       - "New output spacing if different from input"  double  no      multiple
+option "spacinglike"   - "New output spacing like this image"          string  no
+option "origin"                - "New output origin if different from input"   double  no      multiple
+option "matrix"                m "Affine matrix (homogene) filename"           string  no
+option "elastix"       e "Read EulerTransform from elastix output file (combine if multiple)"  string  no
+option "rotate"                r "Rotation to apply (radians)"                 double  no      multiple
+option "translate"     t "Translation to apply (mm)"                   double  no      multiple
+option "pad"           - "Edge padding value"                          double  no      default="0.0"
 
 section "Interpolation"
-option "interp"                -       "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT"      int     no  default="1"
-option "interpOrder"   -       "Order if BLUT or BSpline (0-5)"                        int     no  default="3"
-option "interpSF"      -       "Sampling factor if BLUT"                               int     no  default="20"
-option "interpVF"      -       "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT"      int     no  default="1"
-option "interpVFOrder" -       "Order if BLUT or BSpline (0-5)"                        int     no  default="3"
-option "interpVFSF"    -       "Sampling factor if BLUT"                               int     no  default="20"
+option "interp"                - "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT"    int     no  default="1"
+option "interpOrder"   - "Order if BLUT or BSpline (0-5)"                      int     no  default="3"
+option "interpSF"      - "Sampling factor if BLUT"                             int     no  default="20"
+option "interpVF"      - "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT"    int     no  default="1"
+option "interpVFOrder" - "Order if BLUT or BSpline (0-5)"                      int     no  default="3"
+option "interpVFSF"    - "Sampling factor if BLUT"                             int     no  default="20"
 
 
 
index 1fa58b582919d4d7b03447f4be7aecb14a8738ac..65d66dc741c6256637eefbeb5c222a25860caf87 100644 (file)
@@ -212,6 +212,7 @@ namespace clitk
       likeReader->SetFileName(m_ArgsInfo.like_arg);
       likeReader->Update();
       resampler->SetOutputParametersFromImage(likeReader->GetOutput());
+      resampler->SetOutputDirection(likeReader->GetOutput()->GetDirection());
     } else if(m_ArgsInfo.transform_grid_flag) {
       typename itk::Matrix<double, Dimension+1, Dimension+1> invMatrix( matrix.GetInverse() );
       typename itk::Matrix<double, Dimension, Dimension> invRotMatrix( clitk::GetRotationalPartMatrix(invMatrix) );
index 7e5a92eba7cf32d67775e1910d596290c8f5eee9..1f5fd03f3a78c905ecd666dc2376569b674e9fa3 100644 (file)
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
 ===========================================================================*/
+
+#include "clitkGammaIndex_ggo.h"
+#include "clitkIO.h"
+#include "clitkDD.h"
+
+#include <iostream>
+#include <cmath>
+#include <cassert>
+
 #include <vtkPoints.h>
 #include <vtkCellArray.h>
 #include <vtkPointData.h>
 #include <vtkPNGReader.h>
 #include <vtkPolyData.h>
 #include <vtkCellLocator.h>
-#include <iostream>
-#include <cmath>
-#include <cassert>
-using std::endl;
-using std::cout;
 
-#include "clitkGammaIndex_ggo.h"
-
-#include <clitkIO.h>
 #include <vvImage.h>
 #include <vvImageReader.h>
 #include <vvImageWriter.h>
@@ -42,6 +43,9 @@ using std::cout;
 typedef itk::Image<double> OutputImageType;
 typedef itk::ImageRegionIterator<OutputImageType> OutputImageIterator;
 
+using std::endl;
+using std::cout;
+
 vtkImageData* loadImage(const std::string& filename)
 {
     vvImageReader::Pointer reader = vvImageReader::New();
@@ -224,7 +228,7 @@ int main(int argc,char * argv[])
     // load reference
     vtkImageData* reference = loadImage(reference_filename);
     assert(reference);
+
     // translate target with arguments values
     // reference is translated instead of target so that the output space stay the same as target
     {
@@ -248,10 +252,13 @@ int main(int argc,char * argv[])
 
     vtkAbstractCellLocator *locator = vtkCellLocator::New();
     locator->SetDataSet(data);
-    data->Delete();
+    DD("here");
+    //    data->Delete();
     locator->CacheCellBoundsOn();
     locator->AutomaticOn();
+    DD("BuildLocator");
     locator->BuildLocator();
+    DD("end BuildLocator");
 
     // load target
     vtkImageData* target = loadImage(target_filename);
@@ -277,6 +284,7 @@ int main(int argc,char * argv[])
     unsigned long over_one = 0;
     OutputImageIterator iter(output,output->GetLargestPossibleRegion());
     iter.GoToBegin();
+    DD("loop");
     while (!iter.IsAtEnd()) {
        double *point = target->GetPoint(kk);
        double value = target->GetPointData()->GetScalars()->GetTuple1(kk);
@@ -315,4 +323,3 @@ int main(int argc,char * argv[])
 
     return 0;
 }
-
index 5d462407437554b29aa753d6fffce21c2f5d5c39..b87114d6d591008f715c8d20989fdc3c6fd7b49d 100644 (file)
@@ -276,12 +276,14 @@ namespace clitk
         if(m_ArgsInfo.dvhistogram_given)
         {
             typename StatisticsImageFilterType::HistogramPointer dvhistogram = statisticsFilter->GetHistogram(label);
+            double totalVolumeCC = ((statisticsFilter->GetCount(label))*spacing_cc);
+            double totalVolume = statisticsFilter->GetCount(label);
 
             // Screen
             std::cout<<"# Total volume : ";
-            std::cout<<statisticsFilter->GetCount(label)<<" [No. of voxels]"<<std::endl;
+            std::cout<<totalVolume<<" [No. of voxels]"<<std::endl;
             std::cout<<"# Total volume : ";
-            std::cout<<((statisticsFilter->GetCount(label))*spacing_cc)<<" [cc]"<<std::endl;
+            std::cout<<totalVolumeCC<<" [cc]"<<std::endl;
             std::cout<<"# Dose mean: ";
             std::cout<<statisticsFilter->GetMean(label)<<" [Gy]"<<std::endl;
             std::cout<<"# Dose min: ";
@@ -289,7 +291,7 @@ namespace clitk
             std::cout<<"# Dose max: ";
             std::cout<<statisticsFilter->GetMaximum(label)<<" [Gy]"<<std::endl;
             std::cout<<" "<<std::endl;
-            std::cout<<"#Dose_diff[Gy] Volume_diff[No. of voxels] Volume_diff[%] Volume_diff[cc] #Dose_cumul[Gy] Volume_cumul[No. of voxels] Volume_cumul[%] Volume_cumul[cc]"<<std::endl;
+            std::cout<<"#Dose_diff[Gy] Volume_diff[No. of voxels] Volume_diff[%] Volume_diff[cc] Volume_cumul[No. of voxels] Volume_cumul[%] Volume_cumul[cc]"<<std::endl;
             for( int i =0; i <m_ArgsInfo.bins_arg; i++)
             {
               double popCumulativeVolume = 0;
@@ -297,17 +299,11 @@ namespace clitk
               {
                  popCumulativeVolume+=(dvhistogram->GetFrequency(j));
               }
-              double cumulativeVolume = popCumulativeVolume + (dvhistogram->GetFrequency(i));
+              double cumulativeVolume = (totalVolume - (popCumulativeVolume + (dvhistogram->GetFrequency(i))));
               double percentCumulativeVolume =(cumulativeVolume*100)/(statisticsFilter->GetCount(label)) ;
-              double ccCumulativeVolume = (popCumulativeVolume + (dvhistogram->GetFrequency(i)))*spacing_cc;
+              double ccCumulativeVolume = (totalVolumeCC -((popCumulativeVolume + (dvhistogram->GetFrequency(i)))*spacing_cc));
               double percentDiffVolume = dvhistogram->GetFrequency(i)*100/(statisticsFilter->GetCount(label));
-              if(i == 0)
-              {
-                 std::cout<<dvhistogram->GetBinMax(0,i)<<"\t  "<<dvhistogram->GetFrequency(i)<<"\t  "<<percentDiffVolume<<"\t "<<((dvhistogram->GetFrequency(i))*spacing_cc)<<"\t "<<m_ArgsInfo.bins_arg<<"\t "<<cumulativeVolume<<"\t  "<<percentCumulativeVolume<<"\t  "<<ccCumulativeVolume<<"\t "<<std::endl;
-              }else
-              {
-                 std::cout<<dvhistogram->GetBinMax(0,i)<<"\t  "<<dvhistogram->GetFrequency(i)<<"\t  "<<percentDiffVolume<<"\t "<<((dvhistogram->GetFrequency(i))*spacing_cc)<<"\t "<<dvhistogram->GetBinMin(0,m_ArgsInfo.bins_arg-i)<<"\t "<<cumulativeVolume<<"\t  "<<percentCumulativeVolume<<"\t  "<<ccCumulativeVolume<<"\t "<<std::endl;
-              }
+              std::cout<<dvhistogram->GetBinMax(0,i)<<"\t  "<<dvhistogram->GetFrequency(i)<<"\t  "<<percentDiffVolume<<"\t "<<((dvhistogram->GetFrequency(i))*spacing_cc)<<"\t "<<"\t "<<cumulativeVolume<<"\t  "<<percentCumulativeVolume<<"\t  "<<ccCumulativeVolume<<"\t "<<std::endl;
             }
 
             // Add to the file
@@ -315,7 +311,7 @@ namespace clitk
             dvhistogramFile<<"# Total volume : ";
             dvhistogramFile<<statisticsFilter->GetCount(label)<<" [No. of voxels]"<<std::endl;
             dvhistogramFile<<"# Total volume : ";
-            dvhistogramFile<<((statisticsFilter->GetCount(label))*spacing_cc)<<" [cc]"<<std::endl;
+            dvhistogramFile<<totalVolumeCC<<" [cc]"<<std::endl;
             dvhistogramFile<<"# Dose mean: ";
             dvhistogramFile<<statisticsFilter->GetMean(label)<<" [Gy]"<<std::endl;
             dvhistogramFile<<"# Dose min: ";
@@ -323,7 +319,7 @@ namespace clitk
             dvhistogramFile<<"# Dose max: ";
             dvhistogramFile<<statisticsFilter->GetMaximum(label)<<" [Gy]"<<std::endl;
             dvhistogramFile<<"  "<<std::endl;
-            dvhistogramFile<<"#Dose_diff[Gy] Volume_diff[No. of voxels] Volume_diff[%] Volume_diff[cc] #Dose_cumulative[Gy] Volume_cumul[No. of voxels] Volume_cumul[%] Volume_cumul[cc]"<<std::endl;
+            dvhistogramFile<<"#Dose_diff[Gy] Volume_diff[No. of voxels] Volume_diff[%] Volume_diff[cc] Volume_cumul[No. of voxels] Volume_cumul[%] Volume_cumul[cc]"<<std::endl;
             for( int i =0; i <m_ArgsInfo.bins_arg; i++)
             {
                double popCumulativeVolume = 0;
@@ -331,17 +327,11 @@ namespace clitk
                {
                  popCumulativeVolume+=(dvhistogram->GetFrequency(j));
                }
-               double cumulativeVolume = popCumulativeVolume + (dvhistogram->GetFrequency(i));
-               double percentCumulativeVolume =(cumulativeVolume*100)/(statisticsFilter->GetCount(label)) ;
-               double ccCumulativeVolume = (popCumulativeVolume + (dvhistogram->GetFrequency(i)))*spacing_cc;
+               double cumulativeVolume = (totalVolume - (popCumulativeVolume + (dvhistogram->GetFrequency(i))));
+               double percentCumulativeVolume =(cumulativeVolume*100)/(statisticsFilter->GetCount(label));
+               double ccCumulativeVolume = (totalVolumeCC -((popCumulativeVolume + (dvhistogram->GetFrequency(i)))*spacing_cc));
                double percentDiffVolume = ((dvhistogram->GetFrequency(i))*100)/(statisticsFilter->GetCount(label));
-               if(i == 0)
-               {
-                 dvhistogramFile<<dvhistogram->GetBinMax(0,i)<<"\t  "<<dvhistogram->GetFrequency(i)<<"\t  "<<percentDiffVolume<<"\t "<<((dvhistogram->GetFrequency(i))*spacing_cc)<<"\t "<<m_ArgsInfo.bins_arg<<"\t "<<cumulativeVolume<<"\t  "<<percentCumulativeVolume<<"\t  "<<ccCumulativeVolume<<std::endl;
-               }else
-               {
-                 dvhistogramFile<<dvhistogram->GetBinMax(0,i)<<"\t  "<<dvhistogram->GetFrequency(i)<<"\t  "<<percentDiffVolume<<"\t "<<((dvhistogram->GetFrequency(i))*spacing_cc)<<"\t "<<dvhistogram->GetBinMin(0,m_ArgsInfo.bins_arg-i)<<"\t "<<cumulativeVolume<<"\t  "<<percentCumulativeVolume<<"\t  "<<ccCumulativeVolume<<std::endl;
-               }
+               dvhistogramFile<<dvhistogram->GetBinMax(0,i)<<"\t  "<<dvhistogram->GetFrequency(i)<<"\t  "<<percentDiffVolume<<"\t "<<((dvhistogram->GetFrequency(i))*spacing_cc)<<"\t "<<cumulativeVolume<<"\t "<<percentCumulativeVolume<<"\t  "<<ccCumulativeVolume<<std::endl;
            }
         }
       }
index 49d4075997b87e278216d2546a19e2faa393311d..8477a35d8c085574e7829a2b7dd1e2dfc8af2280 100644 (file)
@@ -155,7 +155,7 @@ namespace clitk
     SpacingType spacing = input->GetSpacing(), like_spacing = like_image->GetSpacing(); 
     if (spacing != like_spacing) {
       std::cerr << "Like-image must have same spacing as input: " << spacing << " " << like_spacing << std::endl;
-      return ERR_NOT_SAME_SPACING;
+      return PAD_ERR_NOT_SAME_SPACING;
     }
     
     SizeType size = input->GetLargestPossibleRegion().GetSize(), like_size = like_image->GetLargestPossibleRegion().GetSize();
@@ -175,7 +175,7 @@ namespace clitk
 
       if (auxl < 0 || auxu < 0) {
         std::cerr << "Like-image's bounding box must be larger than input's" << std::endl;
-        return ERR_NOT_LIKE_LARGER;
+        return PAD_ERR_NOT_LIKE_LARGER;
       }
 
       padLower[i] = (PadBoundType)auxl;
@@ -184,7 +184,7 @@ namespace clitk
     
     if (mArgsInfo.verbose_flag)
       std::cout << "PadLike - OUT" << std::endl;
-    return ERR_SUCCESS;
+    return PAD_ERR_SUCCESS;
   }
 } //end clitk
 
index 3aa9318057fa8ca850c2a29169dd058778f9807b..429d203d6588909abc7130d87ebf4e4b609a1679 100644 (file)
@@ -24,7 +24,6 @@
 #include "clitkImageToImageGenericFilter.h"
 #include "clitkPadImage_ggo.h"
 
-
 //--------------------------------------------------------------------
 namespace clitk
 {
@@ -35,9 +34,9 @@ namespace clitk
   public:
     enum
     {
-      ERR_SUCCESS = 0,
-      ERR_NOT_SAME_SPACING = -1,
-      ERR_NOT_LIKE_LARGER = -2
+      PAD_ERR_SUCCESS = 0,
+      PAD_ERR_NOT_SAME_SPACING = -1,
+      PAD_ERR_NOT_LIKE_LARGER = -2
     };
 
     //--------------------------------------------------------------------