]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
authorDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Tue, 7 Jun 2016 09:20:33 +0000 (11:20 +0200)
committerDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Tue, 7 Jun 2016 09:20:33 +0000 (11:20 +0200)
.vimrc [deleted file]
cluster_tools/gate_job_cluster.job
itk/clitkCropLikeImageFilter.h
itk/clitkInvertVFFilter.txx
tools/clitkImageConvert.cxx
tools/clitkImageConvert.ggo
tools/clitkImageConvertGenericFilter.cxx
tools/clitkImageConvertGenericFilter.h
tools/clitkImageStatisticsGenericFilter.cxx
tools/clitkImageStatisticsGenericFilter.txx
vv/vvMidPosition.cxx

diff --git a/.vimrc b/.vimrc
deleted file mode 100644 (file)
index 97cf20f..0000000
--- a/.vimrc
+++ /dev/null
@@ -1,10 +0,0 @@
-"clitk related standards
-"
-set cindent
-set softtabstop=0 "disable
-set expandtab
-"set cino={.5s,e-.5s,^-.5s
-set shiftwidth=2
-
-set makeprg=${HOME}/workspace/cvs/clitk3/fast_make.sh
-set grepprg=clgrep
index e95f7c0e23551d01f7e90b32220d4fb3f651b955..9401268acb080c8e348d88d288feabf78ab30930 100644 (file)
@@ -74,7 +74,8 @@ echo "Lauching macro"
 date
 if test "$RELEASEDIR" = "NONE"
 then
-       Gate ${PARAM} ${MACROFILE} || error "gate failed"
+        echo Gate ${PARAM} ${MACROFILE}
+       eval Gate ${PARAM} ${MACROFILE} || error "gate failed"
 else
        LD_PRELOAD="${ROOTLIBS}${G4LIBS}${CLHEPLIBS}${GATELIBS}" \
        G4LEVELGAMMADATA="${RELEASEDIR}/PhotonEvaporation2.1" \
index c8fae32891eef1c3a7b1f305fcf4e3fbb716cb06..cc7623f5741a49a2d4e0efc735e95ecd8a9311a5 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
 
 // clitk
 #include "clitkBoundingBoxUtils.h"
+#include "clitkImageCommon.h"
 
 // itk
 #include <itkImageToImageFilter.h>
 
 namespace clitk {
-  
+
   //--------------------------------------------------------------------
   /*
     Perform various cropping operation on a image
   */
   //--------------------------------------------------------------------
-  
+
   template <class ImageType>
   class ITK_EXPORT CropLikeImageFilter: public itk::ImageToImageFilter<ImageType, ImageType> {
   public:
@@ -41,10 +42,10 @@ namespace clitk {
     typedef itk::ImageToImageFilter<ImageType, ImageType>  Superclass;
     typedef itk::SmartPointer<Self>                        Pointer;
     typedef itk::SmartPointer<const Self>                  ConstPointer;
-    
+
     /** Method for creation through the object factory. */
     itkNewMacro(Self);
-    
+
     /** Run-time type information (and related methods). */
     itkTypeMacro(CropLikeImageFilter, ImageToImageFilter);
 
@@ -64,7 +65,7 @@ namespace clitk {
 
     // Set Background if 'like' is greater than input
     itkSetMacro(BackgroundValue, PixelType);
-    itkGetConstMacro(BackgroundValue, PixelType); 
+    itkGetConstMacro(BackgroundValue, PixelType);
 
     /** ImageDimension constants */
     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
@@ -75,11 +76,11 @@ namespace clitk {
   protected:
     CropLikeImageFilter();
     virtual ~CropLikeImageFilter() {}
-    
+
     virtual void GenerateOutputInformation();
     virtual void GenerateData();
     virtual void GenerateInputRequestedRegion();
-    
+
     PixelType m_BackgroundValue;
     RegionType m_OutputRegion;
     RegionType m_Region;
@@ -88,41 +89,41 @@ namespace clitk {
     PointType m_Origin;
     const itk::ImageBase<ImageDimension> * m_LikeImage;
     std::vector<bool> m_CropAlongThisDimension;
-    
+
     PointType m_StartPoint;         // start point in physical world
-    IndexType m_StartSourceIndex;   // start index in "source" image 
-    IndexType m_StartDestIndex;     // start index in "destination" image 
-    
+    IndexType m_StartSourceIndex;   // start index in "source" image
+    IndexType m_StartDestIndex;     // start index in "destination" image
+
     PointType m_StopPoint;         // stop point in physical world
-    IndexType m_StopSourceIndex;   // stop index in "source" image 
-    IndexType m_StopDestIndex;     // stop index in "destination" image 
-    
+    IndexType m_StopSourceIndex;   // stop index in "source" image
+    IndexType m_StopDestIndex;     // stop index in "destination" image
+
   private:
     CropLikeImageFilter(const Self&); //purposely not implemented
     void operator=(const Self&); //purposely not implemented
-    
+
   }; // end class
   //--------------------------------------------------------------------
 
 
   //--------------------------------------------------------------------
-  // Convenient function 
+  // Convenient function
   template<class ImageType>
   typename ImageType::Pointer
   ResizeImageLike(const ImageType * input,
-                  const itk::ImageBase<ImageType::ImageDimension> * like, 
+                  const itk::ImageBase<ImageType::ImageDimension> * like,
                   typename ImageType::PixelType BG);
 
   template<class ImageType>
   typename ImageType::Pointer
   ResizeImageLike(const ImageType * input,
-                  typename itk::ImageBase<ImageType::ImageDimension>::RegionType * like, 
+                  typename itk::ImageBase<ImageType::ImageDimension>::RegionType * like,
                   typename ImageType::PixelType BG);
 
   template<class ImageType>
   typename ImageType::Pointer
-  ResizeImageLike(const ImageType * input, 
-                  typename itk::BoundingBox<unsigned long, ImageType::ImageDimension>::Pointer bb, 
+  ResizeImageLike(const ImageType * input,
+                  typename itk::BoundingBox<unsigned long, ImageType::ImageDimension>::Pointer bb,
                   typename ImageType::PixelType BG);
 
 
index 525b48692c38a8e78e751a81d2a8fc2d2a027698..c32782f08b84558f1bcf2cc4fa6f59976f94bd4f 100644 (file)
@@ -137,7 +137,7 @@ void HelperClass1<InputImageType, OutputImageType>::ThreadedGenerateData(const O
   typedef typename OutputImageType::PixelType DisplacementType;
   DisplacementType displacement;
   inputIt.GoToBegin();
-  
+
   typename OutputImageType::SizeType size = outputPtr->GetLargestPossibleRegion().GetSize();
 
   //define some temp variables
@@ -191,7 +191,7 @@ void HelperClass1<InputImageType, OutputImageType>::ThreadedGenerateData(const O
             overlap *= 1.0 - distance[dim];
           }
           upper >>= 1;
-          
+
           if (neighIndex[dim] >= size[dim])
             neighIndex[dim] = size[dim] - 1;
         }
@@ -308,7 +308,10 @@ protected:
 //Empty constructor
 template<class InputImageType, class OutputImageType > HelperClass2<InputImageType, OutputImageType>::HelperClass2()
 {
-  m_EdgePaddingValue=itk::NumericTraits<PixelType>::Zero;
+  PixelType zero;
+  for(unsigned int i=0;i <PixelType::Dimension; i++) zero[i] = 0.0;
+  m_EdgePaddingValue=zero;
+  //m_EdgePaddingValue=itk::NumericTraits<PixelType>::Zero;
 }
 
 
@@ -317,7 +320,7 @@ template<class InputImageType, class OutputImageType > HelperClass2<InputImageTy
 template<class InputImageType, class OutputImageType > void HelperClass2<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId )
 {
 //   std::cout << "HelperClass2::ThreadedGenerateData - IN " << threadId << std::endl;
-  
+
   //Get pointer to the input
   typename InputImageType::ConstPointer inputPtr = this->GetInput();
 
@@ -367,9 +370,9 @@ template<class InputImageType, class OutputImageType > void HelperClass2<InputIm
     ++inputIt;
 
   }//end while
-  
+
 //   std::cout << "HelperClass2::ThreadedGenerateData - OUT " << threadId << std::endl;
-  
+
 }//end member
 
 
@@ -389,7 +392,12 @@ namespace clitk
 template <class InputImageType, class OutputImageType>
 InvertVFFilter<InputImageType, OutputImageType>::InvertVFFilter()
 {
-  m_EdgePaddingValue=itk::NumericTraits<PixelType>::Zero; //no other reasonable value?
+
+  //m_EdgePaddingValue=itk::NumericTraits<PixelType>::Zero; //no other reasonable value?
+  PixelType zero;
+  for(unsigned int i=0;i <PixelType::Dimension; i++) zero[i] = 0.0;
+  m_EdgePaddingValue=zero; //no other reasonable value?
+
   m_ThreadSafe=false;
   m_Verbose=false;
 }
@@ -471,7 +479,7 @@ template <class InputImageType, class OutputImageType> void InvertVFFilter<Input
 
   //Set the output
   this->SetNthOutput(0, helper2->GetOutput());
-  
+
   //std::cout << "InvertVFFilter::GenerateData - OUT" << std::endl;
 }
 
index 3a9beaf4a25406dbfd0d5ece95bf5b04d7a8db59..81386821e37e62d4725748729f7f9a5883fcd66b 100644 (file)
@@ -68,6 +68,7 @@ int main(int argc, char * argv[])
   filter->SetIOVerbose(args_info.verbose_flag);
   filter->SetOutputFilename(output);
   filter->SetVV(args_info.vv_flag);
+  filter->SetCorrectNegativeSpacingFlag(args_info.correct_flag);
   filter->EnableWriteCompression(args_info.compression_flag);
   if (args_info.type_given) filter->SetOutputPixelType(args_info.type_arg);
 
@@ -80,4 +81,3 @@ int main(int argc, char * argv[])
 //-------------------------------------------------------------------=
 
 #endif /* end #define CLITKIMAGECONVERT_CXX */
-
index b6f003c8f9fb9ad6339afbf8e0500a23799d31c0..6d74318e776a08770c2be3ac0ab4bbeba04a40d4 100644 (file)
@@ -10,3 +10,4 @@ option "type"        t "Output type (float, ushort ...)"
 option "verbose"     v "Verbose"                                                    flag   off
 option "compression" c "Compress output"                                            flag   off
 option "vv"          - "Read image as in vv and save transform in meta information" flag   off
+option "correct"     - "Correct dicom with negative Z spacing"                      flag   off
index 2783053fdb2d7546c4096948e621c38a7a4fdeb2..a60338513175f4bb526f79b31d784af495a8fc39 100644 (file)
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
   ===========================================================================**/
+
 #ifndef CLITKIMAGECONVERTGENERICFILTER_CXX
 #define CLITKIMAGECONVERTGENERICFILTER_CXX
 
 #include "clitkImageConvertGenericFilter.h"
 #include "vvImageReader.h"
 #include "vvImageWriter.h"
+#include "itkFlipImageFilter.h"
+#include "itkGDCMImageIO.h"
+
+#include "gdcmReader.h"
+#include "gdcmAttribute.h"
+#include "gdcmPrinter.h"
+#include "gdcmDict.h"
+#include "gdcmStringFilter.h"
 
 //--------------------------------------------------------------------
 clitk::ImageConvertGenericFilter::ImageConvertGenericFilter():
@@ -30,7 +39,8 @@ clitk::ImageConvertGenericFilter::ImageConvertGenericFilter():
   mDisplayWarning = true;
   mWarning = "";
   mWarningOccur = false;
-  
+  SetCorrectNegativeSpacingFlag(false);
+
   InitializeImageType<2>();
   InitializeImageType<3>();
   InitializeImageType<4>();
@@ -90,12 +100,85 @@ void clitk::ImageConvertGenericFilter::UpdateWithInputImageType()
     return;
   }
   else if ((m_PixelTypeName == mOutputPixelTypeName) || (mOutputPixelTypeName == "NotSpecified")) {
+
+    // Get input image
     typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
-    this->SetNextOutput<InputImageType>(input);
+
+    if (mCorrectNegativeSpacingFlag) {
+      // Read dicom
+      gdcm::Reader reader;
+      reader.SetFileName(m_InputFilenames[0].c_str());
+      // if (!reader.CanReadFile(m_InputFilenames[0])) {
+      //   std::cout << "Error: " << m_InputFilenames[0] << " is not a dicom file. Abort." << std::endl;
+      //   exit(0);
+      // }
+      reader.Read();
+
+      // the dataset is the the set of element we are interested in:
+      gdcm::DataSet & ds = reader.GetFile().GetDataSet();
+
+      // Read the attribute SpacingBetweenSlices, check if negative and replace
+      gdcm::Attribute<0x0018,0x0088> SpacingBetweenSlices;
+      SpacingBetweenSlices.SetFromDataSet(ds);
+      double s = SpacingBetweenSlices.GetValue();
+      if (s >=0) {
+        std::cout << "Error: no negative spacing found SpacingBetweenSlices = " << s << " Abort. " << std::endl;
+        exit(0);
+      }
+      s = -s;
+
+      // Set spacing
+      typename InputImageType::SpacingType spacing = input->GetSpacing();
+      spacing[2] = s;
+      input->SetSpacing(spacing);
+
+      // Flip
+      typedef itk::FlipImageFilter< InputImageType >  FilterType;
+      typename FilterType::Pointer filter = FilterType::New();
+      typedef typename FilterType::FlipAxesArrayType     FlipAxesArrayType;
+      FlipAxesArrayType flipArray;
+      flipArray[0] = false;
+      flipArray[1] = false;
+      flipArray[2] = true;
+      filter->SetFlipAxes(flipArray);
+      filter->SetInput(input);
+      filter->Update();
+
+      // Read the attribute  Image Position (Patient)
+      gdcm::Tag  DetectorInformationSequenceTag(0x0054,0x0022);
+      const gdcm::DataElement & DIS = ds.GetDataElement(DetectorInformationSequenceTag);
+      gdcm::SmartPointer<gdcm::SequenceOfItems> sqf = DIS.GetValueAsSQ();
+      gdcm::Item & item = sqf->GetItem(1);
+      gdcm::DataSet & ds_position = item.GetNestedDataSet();
+      gdcm::Attribute<0x0020,0x0032> ImagePositionPatient;
+      ImagePositionPatient.SetFromDataSet(ds_position);
+      double x = ImagePositionPatient.GetValue(0);
+      double y = ImagePositionPatient.GetValue(1);
+      double z = ImagePositionPatient.GetValue(2);
+
+      // Set offset
+      typename InputImageType::PointType origin = input->GetOrigin();
+      origin[0] = x;
+      origin[1] = y;
+      origin[2] = z;
+      input->SetOrigin(origin);
+
+      // Orientation
+      typename InputImageType::DirectionType direction = input->GetDirection();
+      direction[2][2] = -1;
+      input->SetDirection(direction);
+
+      // Empty meta info
+      itk::MetaDataDictionary dict;// = new itk::MetaDataDictionary;
+      input->SetMetaDataDictionary(dict);
+
+      this->SetNextOutput<InputImageType>(input);
+    }
+
   } else {
-    // "trick" to call independent versions of update according to the 
+    // "trick" to call independent versions of update according to the
     // pixel type (vector or scalar), using partial specializations
-    if (!UpdateWithSelectiveOutputType<InputImageType, ImageConvertTraits<typename InputImageType::PixelType>::IS_VECTOR>::Run(*this, mOutputPixelTypeName))    
+    if (!UpdateWithSelectiveOutputType<InputImageType, ImageConvertTraits<typename InputImageType::PixelType>::IS_VECTOR>::Run(*this, mOutputPixelTypeName))
       exit(-1);
   }
 }
@@ -143,4 +226,3 @@ void clitk::ImageConvertGenericFilter::CheckTypes(
 
 
 #endif /* end #define CLITKIMAGECONVERTGENERICFILTER_CXX */
-
index 8ffb360596833d0225c6b022cc9dd04711dc544d..aa8b2ba64b69496ee2580bc77f3ef3383bd5542b 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
@@ -23,7 +23,7 @@
  * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
  * @date   05 May 2008 10:40:24
 
- * @brief  
+ * @brief
 
  ===================================================================*/
 
@@ -36,7 +36,7 @@
 
 
 namespace clitk {
-  
+
   template <class TPixel>
   class ImageConvertTraits
   {
@@ -47,17 +47,17 @@ namespace clitk {
     }
   };
 
-  template < class TPixel, unsigned int Comp > 
-  class ImageConvertTraits< itk::Vector<TPixel, Comp> > 
-  { 
-  public: 
-    enum { IS_VECTOR = true }; 
+  template < class TPixel, unsigned int Comp >
+  class ImageConvertTraits< itk::Vector<TPixel, Comp> >
+  {
+  public:
+    enum { IS_VECTOR = true };
   };
 
-  class ImageConvertGenericFilter: 
+  class ImageConvertGenericFilter:
     public clitk::ImageToImageGenericFilter<ImageConvertGenericFilter> {
-    
-  public: 
+
+  public:
     // constructor - destructor
     ImageConvertGenericFilter();
 
@@ -68,7 +68,7 @@ namespace clitk {
 
     // New
     itkNewMacro(Self);
-    
+
     // Members functions
     std::string GetInputPixelTypeName() { return m_PixelTypeName; }
     std::string GetOutputPixelTypeName() { return mOutputPixelTypeName; }
@@ -77,15 +77,16 @@ namespace clitk {
     bool IsWarningOccur() { return mWarningOccur; }
     std::string & GetWarning() { return mWarning; }
     void EnableDisplayWarning(bool b) { mDisplayWarning = b; }
+    void SetCorrectNegativeSpacingFlag(bool b) { mCorrectNegativeSpacingFlag = b; }
 
     //--------------------------------------------------------------------
     // Main function called each time the filter is updated
-    template<class InputImageType>  
+    template<class InputImageType>
     void UpdateWithInputImageType();
 
     template<class PixelType, class OutputPixelType>
     void CheckTypes(std::string inType, std::string outType);
-    
+
   protected:
 
     template<unsigned int Dim> void InitializeImageType();
@@ -94,6 +95,7 @@ namespace clitk {
     bool mWarningOccur;
     bool mDisplayWarning;
     bool mVV;
+    bool mCorrectNegativeSpacingFlag;
 
   private:
     template <class InputImageType, bool isVector>
@@ -119,17 +121,17 @@ namespace clitk {
           else
           {
             std::string list = CreateListOfTypes<float, double>();
-            std::cerr << "Error, I don't know the vector output type '" << outputPixelType 
+            std::cerr << "Error, I don't know the vector output type '" << outputPixelType
                       << "'. " << std::endl << "Known types are " << list << "." << std::endl;
             return false;
           }
-          
+
           return true;
       }
 
     private:
-      
-      template <class OutputPixelType> 
+
+      template <class OutputPixelType>
       static void UpdateWithOutputType(ImageConvertGenericFilter& filter)
       {
         // Read
@@ -152,7 +154,7 @@ namespace clitk {
         filter.SetNextOutput<OutputImageType>(cast_filter->GetOutput());
       }
     };
-    
+
     template <class InputImageType>
     class UpdateWithSelectiveOutputType<InputImageType, true>
     {
@@ -160,7 +162,7 @@ namespace clitk {
       static bool Run(ImageConvertGenericFilter& filter, std::string outputPixelType)
       {
         /*
-        // RP: future conversions? 
+        // RP: future conversions?
         if (IsSameType<char>(outputPixelType))
           UpdateWithOutputVectorType<char>();
         else if (IsSameType<uchar>(outputPixelType))
@@ -171,7 +173,7 @@ namespace clitk {
           UpdateWithOutputVectorType<ushort>();
         else if (IsSameType<int>(outputPixelType))
           UpdateWithOutputVectorType<int>();
-        else 
+        else
           */
         if (IsSameType<float>(outputPixelType))
           UpdateWithOutputVectorType<float>(filter);
@@ -180,17 +182,17 @@ namespace clitk {
         else
         {
           std::string list = CreateListOfTypes<float, double>();
-          std::cerr << "Error, I don't know the vector output type '" << outputPixelType  
+          std::cerr << "Error, I don't know the vector output type '" << outputPixelType
                     << "'. " << std::endl << "Known types are " << list << "." << std::endl;
           return false;
         }
-        
+
         return true;
       }
-      
+
     private:
-      
-      template <class OutputPixelType> 
+
+      template <class OutputPixelType>
       static void UpdateWithOutputVectorType(ImageConvertGenericFilter& filter)
       {
         // Read
@@ -201,7 +203,7 @@ namespace clitk {
 
         // Warning
         filter.CheckTypes<PixelType, OutputPixelType>(filter.GetInputPixelTypeName(), filter.GetOutputPixelTypeName());
-        
+
         // Cast
         typedef itk::Image<itk::Vector<OutputPixelType, InputImageType::PixelType::Dimension>, InputImageType::ImageDimension> OutputImageType;
         typedef itk::VectorCastImageFilter<InputImageType, OutputImageType> FilterType;
@@ -220,4 +222,3 @@ namespace clitk {
 } // end namespace
 
 #endif /* end #define CLITKIMAGECONVERTGENERICFILTER_H */
-
index 931e1bfe7c12b8002cc2e18eeb5ba5181fb044e8..3d9bea5041106e5d2e6afdd40f5636fcdb29757e 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
@@ -33,7 +33,7 @@ namespace clitk
     m_InputFileName="";
   }
   //-----------------------------------------------------------
-  
+
 
   //-----------------------------------------------------------
   // Update
@@ -44,12 +44,12 @@ namespace clitk
     int Dimension, Components;
     std::string PixelType;
     ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components);
-    
+
     if (m_ArgsInfo.channel_arg < -1 || m_ArgsInfo.channel_arg >= Components) {
       std::cout << "Invalid image channel" << std::endl;
       return;
     }
-    
+
     if (m_ArgsInfo.mask_given) {
       int maskDimension, maskComponents;
       std::string maskPixelType;
@@ -60,17 +60,17 @@ namespace clitk
       }
     }
 
-    
+
     // Call UpdateWithDim
     if (Dimension==2) {
       switch (Components) {
-        case 1: 
+        case 1:
           UpdateWithDim<2,1>(PixelType);
           break;
-        case 2: 
+        case 2:
           UpdateWithDim<2,2>(PixelType);
           break;
-        case 3: 
+        case 3:
           UpdateWithDim<2,3>(PixelType);
           break;
         default:
@@ -80,13 +80,13 @@ namespace clitk
     }
     else if (Dimension==3) {
       switch (Components) {
-        case 1: 
+        case 1:
           UpdateWithDim<3,1>(PixelType);
           break;
-        case 2: 
+        case 2:
           UpdateWithDim<3,2>(PixelType);
           break;
-        case 3: 
+        case 3:
           UpdateWithDim<3,3>(PixelType);
           break;
         default:
@@ -96,13 +96,13 @@ namespace clitk
     }
     else if (Dimension==4) {
       switch (Components) {
-        case 1: 
+        case 1:
           UpdateWithDim<4,1>(PixelType);
           break;
-        case 2: 
+        case 2:
           UpdateWithDim<4,2>(PixelType);
           break;
-        case 3: 
+        case 3:
           UpdateWithDim<4,3>(PixelType);
           break;
         default:
index 6a2a68ebbda35234061b8fa5ca8e6ab30b5120ab..b3eff93ce1082304554c03f1a71589a41d2fa059 100644 (file)
@@ -156,7 +156,7 @@ namespace clitk
 
           }
           else {
-            std::cerr << "Mask image has a different size/spacing than input. Abort" << std::endl;
+            std::cerr << "Mask image has a different size/spacing than input. Abort. (Use option to resize)" << std::endl;
             exit(-1);
           }
         }
@@ -170,6 +170,7 @@ namespace clitk
       labelImage->SetRegions(input->GetLargestPossibleRegion());
       labelImage->SetOrigin(input->GetOrigin());
       labelImage->SetSpacing(input->GetSpacing());
+      labelImage->SetDirection(input->GetDirection());
       labelImage->Allocate();
       labelImage->FillBuffer(m_ArgsInfo.label_arg[0]);
     }
@@ -213,7 +214,7 @@ namespace clitk
 
         std::cout<<std::endl;
         if (m_Verbose) std::cout<<"-------------"<<std::endl;
-        if (m_Verbose) std::cout<<"| Label: "<<label<<"  |"<<std::endl;
+        if (m_Verbose) std::cout<<"| Label: "<< (int) label<<"  |"<<std::endl;
         if (m_Verbose) std::cout<<"-------------"<<std::endl;
 
         // Histograms
index 2290d8765682905342f52c71dc0e9ffd2be772af..d4192d601ed5877478671d0669e2607c2ca63cc0 100644 (file)
@@ -168,7 +168,8 @@ itk::Image<itk::Vector<float,3>,3>::Pointer AverageField(itk::Image<itk::Vector<
 
   // Average
   VFPixelType vector;
-  VFPixelType zeroVector=itk::NumericTraits<VFPixelType>::Zero;
+  VFPixelType zeroVector;//=itk::NumericTraits<VFPixelType>::Zero;
+  for(unsigned int i=0;i <VFPixelType::Dimension; i++) zeroVector[i] = 0.0;
 
   while (!(iterators[0]).IsAtEnd()) {
     vector=zeroVector;
@@ -190,4 +191,3 @@ void vvMidPosition::update_progress()
   p_bar.setValue(progress);
   p_bar.show();
 }
-