[Insight-users] Problems with templated image
Jarek Sacha
galicjan at yahoo . com
Tue, 28 May 2002 14:29:34 -0700 (PDT)
Luis:
I absolutely agree with you. For medical applications in particular, image
type should not be changed and pixel values should not be scaled.
The problem is that type input of input data may vary. A simple example, I
am getting data from an MRI scanner, it is 16 bit or 32 bit, depending how
an operator sets it up. I would like to have single program that handles
both cases without image conversion.
My knowledge of ITK is limited, so I may be mistaken, but it looks to me
that you have to specify image type when you declare image reader. At
runtime, if the input image has different type then it is converted to the
type of image reader. And you really do not have any control over that
conversion. ITK forces image conversion on input since there is no
suitable mechanism to handle various image types at runtime (without
conversion).
What I would like to have functionality in ITK that allows writing
programs able to perform processing that matches input image type, no
conversion. Of course that program should handle any input image type
(within some conceivable bounds). I mean here variable pixel type as a
minimum and also variable image dimension. To enable this the inheritance
hierarch should be extended for templated data representation objects. For
instance, an abstract non-templated image class (derived from DataObject)
should be added. Templated image classes should be derived from that
abstract image class. Pointer to that abstract image class could be passed
down the pipeline. Processing objects could use information obtained
through that pointer to allocate at runtime filters templated by type of
image they are operating on. To make it clear both templated and 'dynamic'
code should be possible.
I will try to write another email later today, maybe in new thread, that
would show an example and explain in some more detail how I see it. If you
see some mistakes in my reasoning so far please let me know.
Jarek
--- Luis Ibanez <luis.ibanez@kitware.com> wrote:
>
> About the difficulty for managing image types
> at run time in ITK: I'm affraid to disagree
> with Jarek on this point.
>
> My personal opinion (which probably is not shared
> by other ITK developers) is that medical image
> operations should NOT make types transparent for
> developer nor users.
>
> Pixel-type transparency is probably Ok for
> "Photoshop-kind" of turn-key applications where
> you want to make things very easy for users and
> provide rapid results.
>
> ITK is intended to be used in clinical practice
> for managing real medical images that a doctor
> can use for finding a tumor or guiding a surgery.
>
> The pixel type in a medical image makes the difference
> between detecting an early tumor or not, and that is
> a *huge* difference !
>
> Once you connect a series of filters in a type-transparent
> pipeline it is very hard to keep track of the intermediate
> losses and therefore is not easy to be confident in the
> reliability of the final output.
>
> Pixel type transparency will result in careless
> and irresponsible management of medical information.
> It will probably produce nice pictures but is not
> what we may want to be used by clinicians.
>
>
> (Sorry for being dogmatic on this).
>
>
>
> Luis
>
>
> =======================================
>
> Mark Hastenteufel wrote:
> > Hi Luis,
> >
> > thanks for your prompt answer. You gave me some example code for
> > converting inhouse images to itk images. I have some further
> questions.
> > First, are you sure the code you gave me runs? If I want to compile
> this
> > little piece of test code
> >
> >
> > switch (a) {
> > case 0: typedef vector<int> bb;
> > break;
> > case 1: typedef vector<double> bb;
> > break;
> > }
> >
> > I get the following compile errors:
> >
> > test1.cpp: In function `int main()':
> > test1.cpp:186: conflicting types for `typedef class
> > vector<double,allocator<double> > bb'
> > test1.cpp:184: previous declaration as `typedef class
> > vector<int,allocator<int> > bb'
> >
> >
> > The second questions regards the templated image dimension. What
> should
> > I do, if I do not know the dimension of the image prior reading from
> > disk or converting. We are working in our group with 2D, 3D as well
> as
> > 4D (3D over time) images. So I want to implement code which runs for
> all
> > kind of image dimensionality. Do you have any suggestions regarding
> this
> > problem?
> >
> >
> > Thanks,
> >
> > Mark
> >
> >
>
>
>
>
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com