[Insight-developers] itk::ImageBase::TransformIndexToPhysicalPoint/TransformPointToContinuousIndex ignores spacing?

Tom Vercauteren tom.vercauteren at m4x.org
Wed Mar 18 05:25:36 EDT 2009


Bill,

I definitely agree that having duplicate code should be avoided.

At the risk of getting somewhat off topic here. A good thing would be
to have an option for using NN extrapolation in the main interpolator.
This could be addressed when fixing bug
http://www.itk.org/Bug/view.php?id=6558.

Indeed, unless I am missing something, fixing this bug will require to
test the index within the interpolator in order to at least deal with
the half-pixel borders. So we could easily add an option to specify
the border conditions there.

Also, this raises the question of why we need to have two distinct
interpolators for scalars and vectors. Wouldn't it just work to make
VectorLinearInterpolateImageFunction an empty subclass of
LinearInterpolateImageFunction. Even though I haven't checked
everyting, as far as I can tell, the only required modification for
that would be to change, within LinearInterpolateImageFunction:

  RealType totalOverlap = NumericTraits<RealType>::Zero;
by
  ScalarRealType totalOverlap = NumericTraits<ScalarRealType>::Zero;

and

  value += overlap * static_cast<RealType>(
this->GetInputImage()->GetPixel( neighIndex ) );
by
  value += static_cast<RealType>( this->GetInputImage()->GetPixel(
neighIndex ) ) * overlap;

Indeed RealType and ScalarRealType seem to be correctly defined in
NumericTraitsVectorPixels and
  Self operator * (const ValueType &value) const
is defined in itk::Vector<ValueType,Dimension>

Similarly, I find it frustrating to have a Vector version of classes
that don't really seem to need it:
  VectorResampleImageFilter
  WarpVectorImageFilter
  VectorRescaleIntensityImageFilter
  VectorExpandImageFilter
  etc...


Am I missing something here?



Luis,

Thanks for the information about the policy for moving code from Review.

Regards,
Tom

On Tue, Mar 17, 2009 at 21:32, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> 1) If we add this class, shouldn't we also add a class that works with
> scalar images: LinearInterpolateNearestNeighborExtrapolateImageFunction.
> and,
> 2) If we add this class, shouldn't this class use
> VectorLinearInterpolateImageFunction internally for points that are
> inside the region? I hate to see duplicated code.
>
> Or,
> 3) Do we need this new interpolator at all? Why not do the inside
> region test in the class that uses
> VectorLinearInterplateImageFunction?
>
> Bill
>
> On Tue, Mar 17, 2009 at 12:29 PM, Tom Vercauteren
> <tom.vercauteren at m4x.org> wrote:
>> Well, what is the policy for moving a class from review to ITK proper?
>>
>> It might be a good time to move this interpolator if someone needs it
>> for a bug fix.
>>
>> Thoughts anyone?
>>
>> Tom
>>
>> On Tue, Mar 17, 2009 at 20:12, kent williams
>> <norman-k-williams at uiowa.edu> wrote:
>>> This is actually exactly what I need, but unfortunately, I can't change a
>>> filter that is part of ITK proper to depend on a class in review ;-)
>>>
>>>
>>> On 3/17/09 1:57 PM, "Tom Vercauteren" <tom.vercauteren at m4x.org> wrote:
>>>
>>>> Kent,
>>>>
>>>> You might also want to switch the interpolator for an
>>>> interpolator/extrapolator such as the one I contributed to the Review
>>>> directory:
>>>> http://www.itk.org/Doxygen/html/classitk_1_1VectorLinearInterpolateNearestNeig
>>>> hborExtrapolateImageFunction.html
>>>>
>>>> With this function, all points are considered as inside the buffer. I
>>>> think that this approach makes sense in your case.
>>>>
>>>> Hope this helps,
>>>> Tom
>>>>
>>>> On Tue, Mar 17, 2009 at 19:43, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>>> Look at what I did in ShrinkImageFilter recently. At Hans's request
>>>>> (do we all work for Hans?) I changed the subsampling so that the image
>>>>> centers aligned.
>>>>>
>>>>> Bill
>>>>>
>>>>> On Tue, Mar 17, 2009 at 11:33 AM, kent williams
>>>>> <norman-k-williams at uiowa.edu> wrote:
>>>>>> I was aware of the issue, just never tripped over it before.
>>>>>>
>>>>>> I'm just not sure how to deal with it in this case.  It points out a
>>>>>> fundamental problem in what I'm trying to do.  The net effect is this:
>>>>>>
>>>>>> Image A has dimensions { n, n, n } and spacing { s, s, s }
>>>>>> Image B has dimensions { n/2, n/2, n/2 } and spacing { s*2, s*2, s*2 }
>>>>>> Assume origin = { 0, 0, 0 } for both, and both are in the same orientation.
>>>>>>
>>>>>> Any physical point on an edge farthest from the origin -- e.g. { n-1, y, z
>>>>>> }, { x, n-1, z }, { x, y, n-1 } etc -- is INSIDE image A, but NOT INSIDE
>>>>>> image B.  Even though the two images theoretically have the same volume.
>>>>>>
>>>>>> And this is independent of whether the index is center-of-voxel or corner of
>>>>>> voxel, or whether you're a North-going Zax or a South-going Zax.
>>>>>>
>>>>>> The mind reels.
>>>>>>
>>>>>> On 3/17/09 1:01 PM, "Tom Vercauteren" <tom.vercauteren at gmail.com> wrote:
>>>>>>
>>>>>>> Hi Kent,
>>>>>>>
>>>>>>> You might already be aware of that bug:
>>>>>>> http://www.itk.org/Bug/view.php?id=6558
>>>>>>>
>>>>>>> Right now the use of rounding vs. truncation is not consistent within
>>>>>>> the index <-> world transformations.
>>>>>>>
>>>>>>> Tom
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Notice: This UI Health Care e-mail (including attachments) is covered by the
>>>>>> Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential
>>>>>> and may be legally privileged.  If you are not the intended recipient, you
>>>>>> are hereby notified that any retention, dissemination, distribution, or
>>>>>> copying of this communication is strictly prohibited.  Please reply to the
>>>>>> sender that you have received the message in error, then delete it.  Thank
>>>>>> you.
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Powered by www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at
>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>>>>
>>>>>
>>>
>>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>


More information about the Insight-developers mailing list