[ITK-dev] [ITK-users] Getting info from a very big image file

Richard Beare richard.beare at gmail.com
Mon Dec 11 22:54:31 EST 2017


You can do stuff like this, which isn't meant to read the image:

int readImageInfo(std::string filename, itk::ImageIOBase::IOComponentType
*ComponentType, int *dim)
{
  itk::ImageIOBase::Pointer imageIO =
itk::ImageIOFactory::CreateImageIO(filename.c_str(),
itk::ImageIOFactory::ReadMode);
  if (imageIO.IsNull())
    return 0;


  imageIO->SetFileName(filename.c_str());
  imageIO->ReadImageInformation();

  *ComponentType = imageIO->GetComponentType();
  *dim = imageIO->GetNumberOfDimensions();
  return(1);
}

I think you'll need to look at the streaming examples to extract slices,
and that will probably depend on the reader supporting streaming.


On Tue, Dec 12, 2017 at 2:44 PM, Gib Bogle <g.bogle at auckland.ac.nz> wrote:

> Hello,
>
>
> I am wanting to work with a 50 GB LSM file (3D).  The first step is to be
> able to get the image info: width, height and depth.  I have code that
> works on a small LSM file
>
>
>     im_u16 = reader->GetOutput();
>     width = im_u16->GetLargestPossibleRegion().GetSize()[0];
>     height = im_u16->GetLargestPossibleRegion().GetSize()[1];
>     depth = im_u16->GetLargestPossibleRegion().GetSize()[2];
>
>
> but I see that to do this the whole image must be loaded into memory.
> When I start the program running with the big file I can see that it is
> going to exceed the host machine's 32 GB.  Is there a way to get the image
> dimensions without loading the whole image?  What I am hoping to do is
> split the file into 2D TIFF files - is there any way to extract a 2D slice
> without reading the whole image?  Or will I be forced to run on a  machine
> with more than 50 GB of RAM?
>
>
> Thanks in advance for any suggestions.
>
>
> Best regards
>
> Gib
>
> The ITK community is transitioning from this mailing list to
> discourse.itk.org. Please join us there!
> ________________________________
> 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://public.kitware.com/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20171212/e9439f91/attachment.html>


More information about the Insight-developers mailing list