X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkInvertVFFilter.txx;h=c32782f08b84558f1bcf2cc4fa6f59976f94bd4f;hb=4a4934ca65d9d47729f2c7179f94b79de2f889bc;hp=b74958fb597a83dc9b3f559936973b340ee6874d;hpb=c1f8a7a05902373f2b20600b541352172705e176;p=clitk.git diff --git a/itk/clitkInvertVFFilter.txx b/itk/clitkInvertVFFilter.txx index b74958f..c32782f 100644 --- a/itk/clitkInvertVFFilter.txx +++ b/itk/clitkInvertVFFilter.txx @@ -75,11 +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,13 +113,9 @@ 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(); @@ -146,6 +138,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]; @@ -197,8 +191,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 @@ -243,7 +239,7 @@ void HelperClass1::ThreadedGenerateData(const O ++inputIt; } - //std::cout << "HelperClass1::ThreadedGenerateData - OUT" << std::endl; +// std::cout << "HelperClass1::ThreadedGenerateData - OUT " << threadId << std::endl; } @@ -293,11 +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; @@ -316,20 +308,19 @@ 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(); @@ -379,9 +370,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(); @@ -472,6 +468,7 @@ template void InvertVFFilterSetNumberOfThreads(m_NumberOfThreads); helper2->SetInput(temp); helper2->SetWeights(weights); helper2->SetEdgePaddingValue(m_EdgePaddingValue); @@ -482,6 +479,8 @@ template void InvertVFFilterSetNthOutput(0, helper2->GetOutput()); + + //std::cout << "InvertVFFilter::GenerateData - OUT" << std::endl; }