-
- //====================================================================
- template <class TImageType, class TCoordRep, class TCoefficientType>
- void BSplineInterpolateImageFunctionWithLUT<TImageType,TCoordRep,TCoefficientType>::
- UpdateWeightsProperties() {
-
- // Compute Memory offset inside coefficients images (for looping over coefficients)
- static const unsigned int d = TImageType::ImageDimension;
- mInputMemoryOffset[0] = 1;
- for(unsigned int l=1; l<d; l++) {
- mInputMemoryOffset[l] =
- 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);
- for(unsigned int l=0; l<d; l++) mSupportIndex[0][l] = 0;
- for(unsigned int k=0; k<mSupportSize; k++) {
- // Get memory offset
- mSupportOffset[k] = Index2Offset<TImageType::ImageDimension>(mSupportIndex[k], mInputMemoryOffset);
- // next coefficient index
- if (k != mSupportSize-1) {
- for(unsigned int l=0; l<d; l++) mSupportIndex[k+1][l] = mSupportIndex[k][l];
- int l=0;
- bool stop = false;
- while (!stop) {
- mSupportIndex[k+1][l]++;
- if (static_cast<unsigned int>(mSupportIndex[k+1][l]) == mSupport[l]) {
- mSupportIndex[k+1][l] = 0;
- l++;
- }
- else stop = true;
- }
- }
- }
-
- // // Check
- // for(unsigned int l=0; l<d; l++) {
- // if (mOutputSpacing[l] == -1) {
- // std::cerr << "Please use SetOutputSpacing before using BLUT interpolator" << std::endl;
- // exit(0);
- // }
- // }
-
- // Compute BSpline weights if not up to date
- //if (!mWeightsAreUpToDate)
- UpdatePrecomputedWeights();
+
+ //JV Put here?
+ if (!mWeightsAreUpToDate) {
+ // Compute mSupportOffset according to input size
+ mSupportOffset.resize(mSupportSize);
+ mSupportIndex.resize(mSupportSize);
+ for(unsigned int l=0; l<d; l++) mSupportIndex[0][l] = 0;
+ for(unsigned int k=0; k<mSupportSize; k++) {
+ // Get memory offset
+ mSupportOffset[k] = Index2Offset<TImageType::ImageDimension>(mSupportIndex[k], mInputMemoryOffset);
+ // next coefficient index
+ if (k != mSupportSize-1) {
+ for(unsigned int l=0; l<d; l++) mSupportIndex[k+1][l] = mSupportIndex[k][l];
+ int l=0;
+ bool stop = false;
+ while (!stop) {
+ mSupportIndex[k+1][l]++;
+ if (static_cast<unsigned int>(mSupportIndex[k+1][l]) == mSupport[l]) {
+ mSupportIndex[k+1][l] = 0;
+ l++;
+ } else stop = true;
+ }