[Insight-developers] Region bug in PNGImageIO

Miller, James V (Research) millerjv@crd.ge.com
Mon, 31 Mar 2003 16:55:57 -0500


Here is what I understand of the ImageIO architecture:

There is a basic disconnect between the ImageIO's view of an ITK image
and the pipeline's view of an ITK image.

The interface between the ImageFileWriter and the ImageIO is at the
level of a "buffer".  The ImageFileWriter sets up an IORegion, spacing,
and origin and passes them to the ImageIO object.  Then the ImageFileWriter
passes down a pointer to a buffer to write. 

So what region and pointer should be set on the ImageIO object? The simple 
answers are the LargestPossibleRegion or the RequestedRegion. But the
pipeline
does not guarentee that the input to the writer will be exactly the
RequestedRegion.
The upstream filter has the option to produce more than the RequestedRegion.

Furthermore, the RequestedRegion may be smaller than the
LargestPossibleRegion.

So we have a choice of writing out the BufferedRegion or the
RequestedRegion.
If we choose the former, then we can just pass the normal buffer pointer 
down to the ImageIO object and set the IORegion to the BufferedRegion. 
It is actually not quite as simple as this because for most of the ImageIO
writers, the IORegion needs to start at index zero. So we would need
to adjust the IORegion. If we choose the latter, then we need to do one of 
two things:

1) Create a new buffer that is contiguous in memory and only contains pixels
of the RequestedRegion. Then set the IORegion such that its indices start 
at zero.

2) Pass two regions down to the ImageIO objects.  One that describes the 
buffer and one that describes what subregion you want to write. Thus, 
the ImageIO objects would need to understand the difference between 
a BufferedRegion and a RequestedRegion.

Another question that arises in considering the output of the
RequestedRegion:
If the RequestedRegion is a subregion of a larger image, should the output
image
be the size of the larger image with only the pixels in the subregion set?
(i.e.
padded with zeros?).






> -----Original Message-----
> From: Joshua Cates [mailto:cates@sci.utah.edu]
> Sent: Friday, March 28, 2003 11:13 PM
> To: Insight-Developers
> Subject: [Insight-developers] Region bug in PNGImageIO
> 
> 
> Hi,
> 
> As discussed in todays TCON, PNGImageIO does not produce a 
> valid output 
> when given an image whose start index is not 0,0.  
> Insight/Examples/ImageRegionIterator illustrates this problem.
> 
> Josh.
> 
> ______________________________
>  Josh Cates			
>  School of Computer Science	
>  University of Utah
>  Email: cates@sci.utah.edu
>  Phone: (801) 587-7697
>  URL:   http://www.sci.utah.edu/~cates
> 
> 
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>