[Insight-users] Trouble reading 8bit BMP images as a VectorImage

Matt McCormick matt.mccormick at kitware.com
Mon Aug 19 09:20:18 EDT 2013


Hi Cyrille,

Your contributions are welcome and appreciated.

Yes, ImageFileReader::SetImageIO() is the way to go.  A new BMPImageIO
could be created with BMPImageIO::New().

Thanks,
Matt


On Mon, Aug 19, 2013 at 10:29 AM, Cyrille Faucheux <
cyrille.faucheux at etu.univ-tours.fr> wrote:

> Thanks Matt,
>
> I've read a bit more about the BMP file format, to find out that bitmap
> files cannot store grayscale images: a color palette is always required for
> bit depth <= 8, and treating the index value as a grayscale intensity is
> some kind of hack, hence de Allow8BitBMP flag.
>
> I will be happy to try to write a patch, but something is bothering me:
> Exposing the flag out of the BMPImageIO class seems quite straightforward,
> but how this flag is supposed to be set when using a factory like
> ImageFileReader?
> I see there is a ImageFileReader::SetImageIO() method. Should I obtain the
> ImageIO with ImageIOFactory::CreateImageIO(filename, ...), change the newly
> exposed flag when it is a BMPImageIO, and set the ImageIO of the reader
> before effectively loading the image, or is there a simplest way?
>
> Cyrille
>
> ----- Mail original -----
> De: "Matt McCormick" <matt.mccormick at kitware.com>
> À: "Cyrille Faucheux" <cyrille.faucheux at etu.univ-tours.fr>
> Cc: insight-users at itk.org
> Envoyé: Samedi 17 Août 2013 21:33:58
> Objet: Re: [Insight-users] Trouble reading 8bit BMP images as a VectorImage
>
> Hi Cyrille,
>
> Examining the log file for the itkBMPImageIO.h,
>
>   git log -- Modules/IO/BMP/include/itkBMPImageIO.h
>
> the behavior for 8 bit BMP's was changes with this patch [1], which
> corresponds with this issue [2].
>
> If you would like to expose this flag, patches are welcome.
> Instructions can be found here [3].
>
> Thanks,
> Matt
>
>
> [1]
> http://itk.org/gitweb?p=ITK.git;a=commit;h=aaff761c6bbf5b0dfca42c0a9d84eab900631199
> [2]
> http://www.itk.org/Bug/bug_relationship_graph.php?bug_id=7773&graph=dependency
> [3]
> http://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/SubmitAPatchToGerrit/index.html
>
>
> On Sat, Aug 17, 2013 at 11:28 AM, Cyrille Faucheux
> <cyrille.faucheux at etu.univ-tours.fr> wrote:
> > Hi,
> >
> > I need to read grayscale and RGB bitmap images as
> itk::VectorImage<double, 3>.
> > ITK always tells me that the grayscale ones have 3 components per pixels.
> > I've checked with multiple tools, those images are really 8bits (no
> color table)
> >
> > I've dug a little, and found in itkBMPImageIO.cxx a flag named
> Allow8BitBMP, which is set to false, that forces 8bit BMP files to be
> recognized as 24bit ones (3 components per pixel).
> >
> > What is bothering me is that there is no way to change this flag. So,
> what is its purpose?
> >
> > Thanks in advance.
> > Cyrille
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.php
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130819/4879778d/attachment.htm>


More information about the Insight-users mailing list