X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkInvertVFFilter.txx;h=e26fed7c77c6b7cac148e970adce1491587742bd;hb=b133f36e1414bcf74518050a4a8e36d32d642981;hp=684b35545add887b43a3827a6efd9ce8d71577d0;hpb=42f68068ef3488c8ca2d921b6835d34fe6494d5f;p=clitk.git diff --git a/itk/clitkInvertVFFilter.txx b/itk/clitkInvertVFFilter.txx index 684b355..e26fed7 100644 --- a/itk/clitkInvertVFFilter.txx +++ b/itk/clitkInvertVFFilter.txx @@ -75,7 +75,11 @@ 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; @@ -113,9 +117,13 @@ void HelperClass1::BeforeThreadedGenerateData() //========================================================================================================================= //update the output for the outputRegionForThread template +#if ITK_VERSION_MAJOR >= 4 +void HelperClass1::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) +#else void HelperClass1::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId ) +#endif { - //std::cout << "HelperClass1::ThreadedGenerateData - IN" << std::endl; +// std::cout << "HelperClass1::ThreadedGenerateData - IN " << threadId << std::endl; //Get pointer to the input typename InputImageType::ConstPointer inputPtr = this->GetInput(); @@ -138,6 +146,8 @@ void HelperClass1::ThreadedGenerateData(const O DisplacementType displacement; inputIt.GoToBegin(); + typename OutputImageType::SizeType size = outputPtr->GetLargestPossibleRegion().GetSize(); + //define some temp variables signed long baseIndex[ImageDimension]; double distance[ImageDimension]; @@ -189,8 +199,10 @@ void HelperClass1::ThreadedGenerateData(const O overlap *= 1.0 - distance[dim]; } upper >>= 1; - } + if (neighIndex[dim] >= size[dim]) + neighIndex[dim] = size[dim] - 1; + } //Set neighbor value only if overlap is not zero @@ -235,7 +247,7 @@ void HelperClass1::ThreadedGenerateData(const O ++inputIt; } - //std::cout << "HelperClass1::ThreadedGenerateData - OUT" << std::endl; +// std::cout << "HelperClass1::ThreadedGenerateData - OUT " << threadId << std::endl; } @@ -285,8 +297,11 @@ 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; @@ -305,16 +320,23 @@ protected: //Empty constructor template HelperClass2::HelperClass2() { - m_EdgePaddingValue=itk::NumericTraits::Zero; + PixelType zero; + for(unsigned int i=0;i ::Zero; } //========================================================================================================================= //update the output for the outputRegionForThread +#if ITK_VERSION_MAJOR >= 4 +template void HelperClass2::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId ) +#else template void HelperClass2::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, int threadId ) +#endif { - //std::cout << "HelperClass2::ThreadedGenerateData - IN" << std::endl; - +// std::cout << "HelperClass2::ThreadedGenerateData - IN " << threadId << std::endl; + //Get pointer to the input typename InputImageType::ConstPointer inputPtr = this->GetInput(); @@ -364,9 +386,9 @@ template void HelperClass2 InvertVFFilter::InvertVFFilter() { - m_EdgePaddingValue=itk::NumericTraits::Zero; //no other reasonable value? + + //m_EdgePaddingValue=itk::NumericTraits::Zero; //no other reasonable value? + PixelType zero; + for(unsigned int i=0;i ::InvertVFFilter() //Update template void InvertVFFilter::GenerateData() { - //std::cout << "InvertVFFilter::GenerateData - IN" << std::endl; + // std::cout << "InvertVFFilter::GenerateData - IN" << std::endl; //Get the properties of the input typename InputImageType::ConstPointer inputPtr=this->GetInput(); @@ -457,6 +484,7 @@ template void InvertVFFilterSetNumberOfThreads(m_NumberOfThreads); helper2->SetInput(temp); helper2->SetWeights(weights); helper2->SetEdgePaddingValue(m_EdgePaddingValue); @@ -467,6 +495,8 @@ template void InvertVFFilterSetNthOutput(0, helper2->GetOutput()); + + //std::cout << "InvertVFFilter::GenerateData - OUT" << std::endl; }