[Insight-users] Simple image property interrogation
Karthik Krishnan
Karthik.Krishnan at kitware.com
Fri Oct 21 14:39:26 EDT 2005
Chris Farmer wrote:
> Hi. I’ve got a simple question about whether/how ITK can be used to
> interrogate some simple image properties such as dimensions and color
> depth. If I just have a path to an image file, can I get this
> information? I’m currently using ImageMagick’s Magick++ API for these
> low-level tasks, but there are other capabilities of ITK that I want
> to use, so I’d prefer not to have to read the image twice like I’m
> doing now.
>
ImageIO's provide a method ReadImageInformation that you can leverage to
perform this query.
Imagine you have your application:
switch( case )
{
itk::ImageFileReader< itk::Image< float, 3 > >::Pointer reader =
ReaderType::New();
reader->SetFIlename(...
reader->GenerateOutputInformation();
reader->GetOuptut()->Print(std::cout);
}
GenerateOutputInformation() leverages the ReadImageInformation method to
get the image metadata. Usually this just reads the headers.
> I looked through the example apps in the source distribution, but
> nothing appeared to address this.
>
> Thanks,
>
> Chris
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>
>
More information about the Insight-users
mailing list