X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=itk%2FclitkVectorBSplineInterpolateImageFunctionWithLUT.txx;h=8ea6e0ab09041fa78dec8878c96d74c762c5942f;hb=8d4aeabfafe155775a520eeb1aabf330e3a9d886;hp=4c6f3eb99efd1fb4acb65258159c9c2503ac7588;hpb=1e034c70105f0926939acaaa27ddb46e904ae8bf;p=clitk.git diff --git a/itk/clitkVectorBSplineInterpolateImageFunctionWithLUT.txx b/itk/clitkVectorBSplineInterpolateImageFunctionWithLUT.txx index 4c6f3eb..8ea6e0a 100644 --- a/itk/clitkVectorBSplineInterpolateImageFunctionWithLUT.txx +++ b/itk/clitkVectorBSplineInterpolateImageFunctionWithLUT.txx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -======================================================================-====*/ +===========================================================================**/ #ifndef _CLITKVECTORBSPLINEINTERPOLATEIMAGEFUNCTIONWITHLUT_TXX #define _CLITKVECTORBSPLINEINTERPOLATEIMAGEFUNCTIONWITHLUT_TXX /* ========================================================================= @@ -42,16 +42,9 @@ VectorBSplineInterpolateImageFunctionWithLUT -// void VectorBSplineInterpolateImageFunctionWithLUT:: -// SetOutputSpacing(const SpacingType & s) { -// for(int i=0; i void VectorBSplineInterpolateImageFunctionWithLUT:: @@ -140,27 +123,11 @@ template void VectorBSplineInterpolateImageFunctionWithLUT:: SetInputImage(const TImageType * inputData) { - - //============================== - // if (!mInputIsCoef) - // { + // JV Call superclass (decomposition filter is executeed each time!) + // JV Should call clitkVectorBSplineDecompositionFilterWithOBD to allow different order by dimension Superclass::SetInputImage(inputData); - // } - - //============================== - // //JV Don't call superclass (decomposition filter is executeed each time!) - // else - // { - // this->m_Coefficients = inputData; - // if ( this->m_Coefficients.IsNotNull()) - // { - // this->m_DataLength = this->m_Coefficients->GetBufferedRegion().GetSize(); - // } - - // //Call super-superclass in case more input arrives - // itk::ImageFunction::RealType, TCoefficientType>::SetInputImage(inputData); - // } - + + // Update the weightproperties if (!inputData) return; UpdateWeightsProperties(); @@ -180,8 +147,6 @@ UpdateWeightsProperties() mInputMemoryOffset[l-1]*this->m_Coefficients->GetLargestPossibleRegion().GetSize(l-1); } - //JV Put here? - if (!mWeightsAreUpToDate) { // Compute mSupportOffset according to input size mSupportOffset.resize(mSupportSize); mSupportIndex.resize(mSupportSize); @@ -199,27 +164,16 @@ UpdateWeightsProperties() if (static_cast(mSupportIndex[k+1][l]) == mSupport[l]) { mSupportIndex[k+1][l] = 0; l++; - } else stop = true; + } + else stop = true; } } } - // // Check - // for(unsigned int l=0; l void VectorBSplineInterpolateImageFunctionWithLUT:: UpdatePrecomputedWeights() { - // mLUTTimer.Reset(); - // mLUTTimer.Start(); mWeightsCalculator.SetSplineOrders(mSplineOrders); mWeightsCalculator.SetSamplingFactors(mSamplingFactors); mWeightsCalculator.ComputeTensorProducts(); mWeightsAreUpToDate = true; - //DS - // coef = new TCoefficientType[mSupportSize]; - // mCorrectedSupportIndex.resize(mSupportSize); - // mCorrectedSupportOffset.resize(mSupportSize); - // mLUTTimer.Stop(); - // mLUTTimer.Print("LUT \t"); } //==================================================================== @@ -259,8 +205,6 @@ GetSampleIndexOfPixelPosition(const ContinuousIndexType & x, IndexType & Evaluat IndexType index; for(int l=0; l *mIntrinsecErrorMax) *mIntrinsecErrorMax = fabs(index[l]-t2); - */ - // When to close to 1, take the next coefficient for odd order, but // only change index for odd if (index[l] == (int)mSamplingFactors[l]) { @@ -309,6 +246,8 @@ VectorBSplineInterpolateImageFunctionWithLUT correctedSupportOffset; if (boundaryCase) { - // return -1000; - //std::vector coef(mSupportSize); - // DD(EvaluateIndex); - //std::vector CorrectedSupportOffset;//(mSupportSize); std::vector correctedSupportIndex;//(mSupportSize); correctedSupportIndex.resize(mSupportSize); correctedSupportOffset.resize(mSupportSize); for(unsigned int i=0; im_Coefficients->GetLargestPossibleRegion().GetSize(l); - // DD(a); - // DD(b); long d2 = 2 * b - 2; if (a < 0) { correctedSupportIndex[i][l] = -a - d2*(-a/d2) - evaluateIndex[l];//mSupportIndex[i][l]-a; @@ -383,10 +315,6 @@ EvaluateAtContinuousIndex(const ContinuousIndexType & x) const // DD(correctedSupportIndex[i]); correctedSupportOffset[i] = itk::Index2Offset(correctedSupportIndex[i], mInputMemoryOffset); } - // for (unsigned int l=0; lm_Coefficients->GetPixel(evaluateIndex)); // Main loop over BSpline support - CoefficientImagePixelType interpolated = 0.0; + CoefficientImagePixelType interpolated = itk::NumericTraits::Zero;; for (unsigned int p=0; p