]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
authorDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Mon, 23 May 2016 06:18:48 +0000 (08:18 +0200)
committerDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Mon, 23 May 2016 06:18:48 +0000 (08:18 +0200)
1  2 
itk/clitkInvertVFFilter.txx
tools/clitkImageStatisticsGenericFilter.txx
vv/vvMidPosition.cxx

index e26fed7c77c6b7cac148e970adce1491587742bd,525b48692c38a8e78e751a81d2a8fc2d2a027698..c32782f08b84558f1bcf2cc4fa6f59976f94bd4f
@@@ -75,11 -75,7 +75,7 @@@ protected
  
    //the actual processing
    void BeforeThreadedGenerateData();
- #if ITK_VERSION_MAJOR >= 4
    void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId );
- #else
-   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId );
- #endif
  
    //member data
    typename  WeightsImageType::Pointer m_Weights;
@@@ -117,11 -113,7 +113,7 @@@ void HelperClass1<InputImageType, Outpu
  //=========================================================================================================================
  //update the output for the outputRegionForThread
  template<class InputImageType, class OutputImageType>
- #if ITK_VERSION_MAJOR >= 4
  void HelperClass1<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId )
- #else
- void HelperClass1<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId )
- #endif
  {
  //   std::cout << "HelperClass1::ThreadedGenerateData - IN " << threadId << std::endl;
    //Get pointer to the input
    typedef typename OutputImageType::PixelType DisplacementType;
    DisplacementType displacement;
    inputIt.GoToBegin();
 -  
 +
    typename OutputImageType::SizeType size = outputPtr->GetLargestPossibleRegion().GetSize();
  
    //define some temp variables
              overlap *= 1.0 - distance[dim];
            }
            upper >>= 1;
 -          
 +
            if (neighIndex[dim] >= size[dim])
              neighIndex[dim] = size[dim] - 1;
          }
@@@ -297,11 -289,7 +289,7 @@@ protected
  
  
    //the actual processing
- #if ITK_VERSION_MAJOR >= 4
    void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId );
- #else
-   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId );
- #endif
  
    //member data
    typename     WeightsImageType::Pointer m_Weights;
  //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;
  }
  
  
  //=========================================================================================================================
  //update the output for the outputRegionForThread
- #if ITK_VERSION_MAJOR >= 4
  template<class InputImageType, class OutputImageType > void HelperClass2<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId )
- #else
- template<class InputImageType, class OutputImageType > void HelperClass2<InputImageType, OutputImageType>::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId )
- #endif
  {
  //   std::cout << "HelperClass2::ThreadedGenerateData - IN " << threadId << std::endl;
 -  
 +
    //Get pointer to the input
    typename InputImageType::ConstPointer inputPtr = this->GetInput();
  
      ++inputIt;
  
    }//end while
 -  
 +
  //   std::cout << "HelperClass2::ThreadedGenerateData - OUT " << threadId << std::endl;
 -  
 +
  }//end member
  
  
@@@ -408,12 -389,7 +392,12 @@@ namespace clit
  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;
  }
@@@ -495,7 -471,7 +479,7 @@@ template <class InputImageType, class O
  
    //Set the output
    this->SetNthOutput(0, helper2->GetOutput());
 -  
 +
    //std::cout << "InvertVFFilter::GenerateData - OUT" << std::endl;
  }
  
index 80ae83a611e37f5f11f11e1be30f6072fbecddee,6a2a68ebbda35234061b8fa5ca8e6ab30b5120ab..b3eff93ce1082304554c03f1a71589a41d2fa059
@@@ -156,7 -156,7 +156,7 @@@ namespace clit
  
            }
            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);
            }
          }
      }
      else {
        labelImage=LabelImageType::New();
+       labelImage->SetDirection(input->GetDirection());
        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]);
      }
  
          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
          std::cout<<statisticsFilter->GetMaximum(label)<<std::endl;
          if (m_Verbose) std::cout<<"Sum: ";
          std::cout<<statisticsFilter->GetSum(label)<<std::endl;
+         if (m_Verbose) std::cout<<"Volume (cc): ";
+         std::cout<<statisticsFilter->GetCount(label)*spacing_cc<<std::endl;
          if (m_Verbose) std::cout<<"Bounding box: ";
          for(unsigned int i =0; i <statisticsFilter->GetBoundingBox(label).size(); i++)
              std::cout<<statisticsFilter->GetBoundingBox(label)[i]<<" ";
diff --combined vv/vvMidPosition.cxx
index f91422a908a11f88acec664242587ff95e04a3a3,2290d8765682905342f52c71dc0e9ffd2be772af..d4192d601ed5877478671d0669e2607c2ca63cc0
@@@ -108,11 -108,7 +108,7 @@@ vvImage::Pointer WarpRefImage(OutputVFT
  
    typename FilterType::Pointer warp_filter = FilterType::New();
    warp_filter->SetInput(input);
- #if ITK_VERSION_MAJOR >= 4
    warp_filter->SetDisplacementField(resampler->GetOutput());
- #else
-   warp_filter->SetDeformationField(resampler->GetOutput());
- #endif
    warp_filter->SetOutputSpacing(input->GetSpacing());
    warp_filter->SetOutputOrigin(input->GetOrigin());
    warp_filter->SetOutputSize(input->GetLargestPossibleRegion().GetSize());
@@@ -172,8 -168,7 +168,8 @@@ itk::Image<itk::Vector<float,3>,3>::Poi
  
    // 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;
@@@ -195,3 -190,4 +191,3 @@@ void vvMidPosition::update_progress(
    p_bar.setValue(progress);
    p_bar.show();
  }
 -