Downsampling at the time of import

I am working on a high-resolution dataset, which is 16GB in size (2000x2000x2000, short data type). It is a tiff sequence. I need to write a set of instructions for people to process such large data in Slicer.

While I have enough memory on my laptop to load the full-resolution image, and then downsample it using the ResampleScalarVolume module, I thought it might be a good option to downsample at time of import. But I don’t think that’s possible through the load data UI. Is the recommended solution to use unu utility for this?

Thanks for the input.

unu is a very handy utility. There are other scripting options too, such as just reading the tif files a slice at a time with vtk and forming a volume from downsampled slices. Probably this should be a custom importer module, at least at first. That would allow you to examine the input and provide options about how you want to downsample it, and maybe crop.

If there’s a common use case then a similar feature could be added to the core load data UI.

Also, @blowekamp had a neat solution for operating on high-res ROIs within downsampled volumes for working with large electron microscopy volumes. You could have a look at the ion abrasion scanning EM extension and see if it’s possible to build on or generalize that.

1 Like

@Steve Thanks for the mention of the module.

I believe the IASEM->Import Image module will do what you want. There is actually nothing specific in this plugin for microscopy data. The import module works with any file format which ITK support for streaming, including RGB images. For TIFF files I believe that ITK will read in a whole slice at a time. I have used it on the Visible Human Data set, when it was a MHA file.

With this module you can specify an ROI, and/or specify shrinking or binning factors to reduce the resolution.

Thanks Steve. So my Slicer 4.8.1 or any of the recent nightlies, no longer has unu.exe. Did you guys stop distributing with Slicer?

@blowekamp. I will give it a try…

I installed the extension (for stable 4.8.1), when I navigate to Input File, the listed compatible file extensions are mha, hdf5, vtk and mrc. I don’t see any other formats for image sequences…

I looks like that limitation is coming from the CLI xml here:

The ITK support for streaming IOs has improved since I wrote that module. I believe that it could be updated to support at least TIFF files, others may work now too. It has been a while since I have had a working Slicer development environment so I can’t quickly experiment to see if the change would work.

Alternatively, could you convert the file to MHA?

We are just getting setup for Slicer development, we might try to tackle this along the way. Thanks.
M

Probably better to do some python scripting instead of using unu - although it’s a handy utility it can be a bit “cryptic” at times and there’s more long-term utility in learning more python scripting.