[Insight-developers] Writing filters : GenerateInputRequeste dRegion() GenerateOutputInformation()

Miller, James V (CRD) millerjv@crd.ge.com
Tue, 20 Feb 2001 11:20:42 -0500


I like it! I have made the changes and am working through the compiler errors.

Jim

-----Original Message-----
From: Luis Ibanez [mailto:ibanez@cs.unc.edu]
Sent: Monday, February 19, 2001 6:56 PM
To: Miller, James V (CRD); insight-developers@public.kitware.com
Subject: Re: [Insight-developers] Writing filters :
GenerateInputRequestedRegion() GenerateOutputInformation()


Hi Jim,

It seems that ImageBase class basically
does nothing at this point.  Could we
template ImageBase over dimension,
(or create an additional intermediary
class if we want to respect the style
of "Base" classes being non-templated)

and move the code for:

- largest possible region
- buffered region
- requested region

from  Image<T,n>   to   ImageBase<n>.

Then ImageAdaptors could derive from ImageBase<>
as you correctly already fixed.

Then itkImage::CopyInformation( DataObject )

could also be moved to ImageBase, and internally
cast the DataObject pointer only to an ImageBase pointer.

That will allow ImageAdaptors to run smoothly,
and we just have to make filters derive from
ImageToImageFilter...to avoid rewriting the methods
related with streaming.




Luis


-------------------------

"Miller, James V (CRD)" wrote:

> Luis,
>
> It doesn't look to me that you need to override GenerateInputRequestedRegion() for your filters.
The
> implementation in ImageToImageFilter should work regardless of the input template type and output
> template type.  (There is no assumption about the input/output types being images.
>
> Can you try removing the GenerateInputRequestedRegion() implementations from the ones you added it
to
> the other day and verify that they would work with the default implementation?
>
> I am still look at the GenerateOutputInformation() implementation to see about getting around the
> assumption of the input being an image.
>
> Jim
>
> -----Original Message-----
> From: Luis Ibanez [mailto:ibanez@cs.unc.edu]
> Sent: Sunday, February 18, 2001 10:06 PM
> To: Insight toolkit
> Subject: [Insight-developers] Writing filters :
> GenerateInputRequestedRegion() GenerateOutputInformation()
>
> Hi,
>
> For those of us writing filters, it
> is important to note that methods:
>
> GenerateOutputInformation() I
>
> and
>
> GenerateInputRequestedRegion()
>
> should in general be overloaded.
>
> The default version of them existing in itkProcessObject
> implicitly assumes that inputs and outputs are images,
> and that doesn't support ImageAdaptors.
>
> For example:
>
> ProcessObject::GenerateOutputInformation()
>
> will call CopyInputInformation() in an output.
> if the output is an itkImage, the CopyInputInformation()
> implicitly assumes thate the input is also an image
> of the SAME type. That causes an erroneous down casting
> and a subsequent seg fault if the input object is not
> really an image.
>
> itkUnaryImageFilter
> itkBinaryImageFilter
> itkTernaryImageFilter
>
> have been updated to provide these two additional methods.
>
> Luis
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers

--
______________________________________________________________________

Luis Ibanez
Research Assistant Professor - Division of Neurosurgery
University of North Carolina at Chapel Hill
CB# 7060, Chapel Hill, NC 27599
email : ibanez@cs.unc.edu       home  : http://www.cs.unc.edu/~ibanez
phone : (919)-843-9961          fax   : (919)-966-6627
______________________________________________________________________