[Insight-developers] towards fixing bug: 9212: Exception when reading 3D image into a 2D image
Bradley Lowekamp
blowekamp at mail.nih.gov
Mon Jun 29 10:04:07 EDT 2009
Hello,
I am working on fixing the bug. In ImageFileReader I need to
calculate the size of the IO buffer based on the IORegion, and I am
missing some function or access to the information I need. I am
proposing adding public methods to ImageIORegion and ImageIOBase:
1)
/** Get the number of pixels contained in this region. This just
* multiplies the size components. */
unsigned long itk::ImageIORegion::GetNumberOfPixels( void ) const;
This methods is just copied from the ImageRegion.
2)
To calculate the buffer size I need the number of pixels and the size
of the pixels (or the size of the components and the number of
components). Currently, the methods ImageIOBase::GetPixelStride is
public, but this methods need to have ComputeStride called for it it
be useful. ( I actually think this methods should still be private ).
We already have GetNumberOfComponents, GetImageSizeInBytes,
GetImageSizeInPixels, and
GetImageSizeInComponents. But no way to access the size of a pixel or
component (unless you for GetImageSizeInBytes/GetImageSizeInPixels,
ick). I propose changing the following methods from protected to public:
/** Compute the size (in bytes) of the pixel. For
* example, and RGB pixel of unsigned char would have size 3 bytes.
*/
virtual unsigned int GetPixelSize() const;
/** Compute the size (in bytes) of the components of a pixel. For
* example, and RGB pixel of unsigned char would have a
* component size of 1 byte. This method can be invoked only after
* the component type is set. */
virtual unsigned int GetComponentSize() const;
Thanks for your comments,
Brad
========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090629/6f647127/attachment.htm>
More information about the Insight-developers
mailing list