[Insight-users] Simultaneous 8-bit/16-bit image compatibility
Luis Ibanez
luis.ibanez at kitware.com
Wed May 25 17:26:17 EDT 2005
Hi Robert,
The choice of pixel type is not a minor issue when
you are dealing with Medical Images.
The fact that your application may receive 8bits or
16bits is actually a very bad sign. It means that
your problem has not been fully defined.
The choice of pixel type in Medical Images *is not*
arbitrary nor accidental. The pixel type decision
will make the difference between detecting a
calcification or not. It makes the difference between
initiating early treatment for a woman with breast
cancer... or sending her back home to wait six months
and come back for a second exam by the time the cancer
is too advanced to be treated effectively.
There is a reason why mammograms are stored in 16 bits.
There is a reason why CT Scans are stored in signed shorts.
There is a reason why PET scans are stored in floats.
Generality of pixel type in Medical Imaging applications
is not an advantage, it is a weakness.
It opens the door to inappropriate use of the patient data.
There are simple tricks that you can do in ITK in order
to make possible for an application to receive images
in 8bits or in 16bits...
However, the important question is:
Why do you want to do that ?
Is your application so fuzzily defined that the image
modality has not been specified ?
If that is the case, then, the problem is not in the
software implementation of the application, but in
the poor specification of the clinical problem.
In any case,
Just to answer your question, what you can do is to
have two readers. One instantiated over 8bits, and
the other over 16bits. The 16bits one, you connect it
to a RescaleIntensityImageFilter with an output image
of 8 bits, or to a IntensityWindowingImageFilter.
At that point you will have to specify the policy
that you want to use for converting these 16 bits
into just 8 bits... (and hopefully not loosing a the
capability of detecting a tumor in the process....).
You will find details about the Intensity rescaling
filter in the ITK Software Guide
http://www.itk.org/ItkSoftwareGuide.pdf
in Section 6.3, "Casting and Intensity Mapping",
pdf-page 172.
Regards,
Luis
---------------------
Robert Maroon wrote:
> I have an algorithm which is designed to work with
> 8-bit image volumes from RAW (+MHD) files, so I use
> typedef's like so:
>
> typedef unsigned char VoxelType;
> typedef itk::Image<DataType,3> VolumeType;
>
> Unfortunately, some of the incoming data may also be
> 16-bit, and I want to be able to process these volumes
> identically without worrying if the incoming data is
> actually 16-bit (versus 8-bit).
>
> However, so far I've only seen ITK examples where a
> specific datatype (e.g., unsigned char/unsigned
> short/float) is used *globally*; I'm not sure if
> there's a way to further abstract the datatype for the
> type of application I'm designing. Is there any
> elegant way of doing this? (i.e., without duplicating
> code to handle the different cases.)
>
> Thanks,
>
> Robert
>
>
More information about the Insight-users
mailing list