]> Creatis software - clitk.git/blobdiff - tools/clitkImageExtractLine.cxx
Added Varian OBI file format
[clitk.git] / tools / clitkImageExtractLine.cxx
index 94590a0a7a152c7abfde290b3fafae02607e0862..0cf94540c70519aa9a50c74546a478ed45dbacf0 100644 (file)
@@ -1,18 +1,22 @@
-/*-------------------------------------------------------------------------
-                                                                                
-  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.
-                                                                                
+/*=========================================================================
+  Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
+
+  Authors belong to:
+  - University of LYON              http://www.universite-lyon.fr/
+  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
+
   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.
-                                                                             
-  -------------------------------------------------------------------------*/
+  PURPOSE.  See the copyright notices for more information.
 
+  It is distributed under dual licence
+
+  - BSD        See included LICENSE.txt file
+  - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+======================================================================-====*/
 #ifndef CLITKIMAGEEXTRACTLINE_CXX
 #define CLITKIMAGEEXTRACTLINE_CXX
-
 /**
    -------------------------------------------------
    * @file   clitkImageExtractLine.cxx
 // clitk include
 #include "clitkImageExtractLine_ggo.h"
 #include "clitkIO.h"
+#include "clitkImageCommon.h"
 #include <itkLineConstIterator.h>
 
 //--------------------------------------------------------------------
-int main(int argc, char * argv[]) {
+int main(int argc, char * argv[])
+{
 
   // Init command line
   GGO(clitkImageExtractLine, args_info);
@@ -36,7 +42,7 @@ int main(int argc, char * argv[]) {
   typedef float PixelType;
   const unsigned int Dimension=3;
   typedef itk::Image<PixelType, Dimension> ImageType;
-  
+
   // Check options
   if (args_info.firstIndex_given != Dimension) {
     std::cerr << "Please give " << Dimension << "values to --firstIndex option" << std::endl;
@@ -58,7 +64,7 @@ int main(int argc, char * argv[]) {
   double length = 0.0;
   for(unsigned int i=0; i<Dimension; i++) {
     firstIndex[i] = args_info.firstIndex_arg[i];
-    lastIndex[i] = args_info.lastIndex_arg[i];    
+    lastIndex[i] = args_info.lastIndex_arg[i];
     if (args_info.mm_flag) {
       firstIndex[i] /= spacing[i];
       lastIndex[i] /= spacing[i];
@@ -77,13 +83,13 @@ int main(int argc, char * argv[]) {
     ++iter;
   }
   double step = length/values.size();
-  
+
   // If isocenter is used
   double isoDistance = 0.0;
   if (args_info.isocenter_given) { // isoCenter is in mm
     IndexType isoCenter;
-    for(unsigned int i=0; i<Dimension; i++) { 
-      isoCenter[i] = args_info.isocenter_arg[i]; 
+    for(unsigned int i=0; i<Dimension; i++) {
+      isoCenter[i] = args_info.isocenter_arg[i];
       isoDistance += pow(isoCenter[i] - firstIndex[i]*spacing[i],2);
     }
     DD(isoCenter);
@@ -106,15 +112,14 @@ int main(int argc, char * argv[]) {
       lg += step;
     }
     os.close();
-  }
-  else {
+  } else {
     for(unsigned int i=0; i<values.size(); i++) {
       os << values[i] << std::endl;
     }
     os.close();
   }
 
-  // this is the end my friend  
+  // this is the end my friend
   return 0;
 } // end main