[Insight-developers] ImageRegion utility functions

Lydia Ng lng@insightful.com
Tue, 16 Apr 2002 09:42:42 -0700


Jim:

> Why can't you use the methods is ImageBase?=20

Okay what I really need is a quick and efficient way to uniformly
sample one index out of an arbitrary region (typically less than
the buffered region).

Currently MI samples the whole buffered region. What I did
was to uniformly pick a number between 0 and numberOfPixels - 1.
Then used ImageBase::ComputeIndex( number ) to get the index.

Brian had made request the the metric have the ability to
support a smaller abitrary region. So for an arbitrary region
I can still pick a number between 0 and the (number of pixels
in the smaller region - 1 ). Then I need to translate this
to an index - I can't use ImageBase::ComputeIndex( number )
because the metric region is smaller than the buffered region.

So I was thinking that was a good functionality for the ImageRegion
to have.=20

I can do a version that doesn't have the extra storage for the
offset table - but then it would be slower.

All suggestions welcome!

- Lydia


> -----Original Message-----
> From: Miller, James V (Research) [mailto:millerjv@crd.ge.com]
> Sent: Tuesday, April 16, 2002 5:49 AM
> To: Lydia Ng; insight-developers@public.kitware.com
> Subject: RE: [Insight-developers] ImageRegion utility functions
>=20
>=20
> Lydia,
>=20
> The problem here is that you cannot correctly compute
> the offset from a single region. The calculations in ImageBase=20
> are based off of the BufferedRegion parameters. So you would need
> to know the buffered region in order to determine the index
> and offset.
>=20
> Also, I would try to avoid the extra storage in the iterators
> (and hence Regions).  Regions get copied a lot. The iterators
> (at least the ImageRegionIterator) does not copy the offset table
> but rather asks the image to compute the index and offset.
>=20
> Why can't you use the methods is ImageBase?  I am assuming that
> if you are calculating an index and an offset you plan to access
> an Image.  So you probably have access to the image and can make
> the calls to Image to convert between offsets and indices.
>=20
>=20
>=20
> -----Original Message-----
> From: Lydia Ng [mailto:lng@insightful.com]
> Sent: Monday, April 15, 2002 6:52 PM
> To: insight-developers@public.kitware.com
> Subject: [Insight-developers] ImageRegion utility functions
>=20
>=20
>=20
> At the UNC meeting I had agree to change
> MutualInformationImageToImageMetric
> so that one can limit the fixed image region for which the metric is
> computed.
>=20
> To do this I need some ImageRegion utility functions in particular:
>=20
>   OffsetValueType ComputeOffset(const IndexType &ind) const;
>     IndexType ComputeIndex(OffsetValueType offset) const;
>=20
>=20
> They will behave similar to those in ImageBase.
> Does anyone have problem with me doing the following?
>=20
> [1] Add the above function to the ImageRegion class?
>=20
> [2] The most efficient way of computing offset and index is
> to keep a offset table? This requires extra storage space of
>=20
> OffsetValueType  m_OffsetTable[VImageDimension+1];
>=20
> Is adding an OffsetTable to ImageRegion acceptable to everyone?
>=20
> [3] Once this functionality is inside region one can possibly remove
> them from ImageBase itself and defer the calculation to the=20
> BufferedRegion? Do people want me to change ImageBase or do they
> want it left the way it is?
>=20
> - Lydia=20
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>=20