[ome-users] NIFTI image spacing information is ignored

Sebastien Besson (Staff) s.besson at dundee.ac.uk
Mon May 28 12:25:30 BST 2018


Hi Taylor,

sorry to hear about your issues and thanks for reporting it. I was able to
reproduce the behavior you described using your code example. Setting debugOn to True reveals that the default sitk.Show() command is opening the image ImageJ/Fiji using the MetaImage file format (.mha) which is not supported by Bio-Formats.

Using the SITK_SHOW_EXTENSION environmement variable, you should be able to modify the  intermediate file format  to use NIFTI. Locally, the following code  opens the image in Fiji through the Bio-Formats plugin with the correct scaling/pixel size information.

import SimpleITK as sitk
import os
os.environ['SITK_SHOW_EXTENSION']='.nii'
image = sitk.Image(64, 64, sitk.sitkFloat32)
image.SetSpacing((2.0, 3.0))
sitk.Show(image, debugOn=True)

Best,
Sebastien
On 25 May 2018, at 15:36, Taylor Braun-Jones <taylor at braun-jones.org> wrote:
When launching a Fiji with a NIFTI image, the spacing information is ignored. For example using SimpleITK:


import SimpleITK as sitk
image = sitk.Image(64, 64, sitk.sitkFloat32)
image.SetSpacing((2.0, 3.0))
sitk.Show(image) # Image shown in ImageJ has unity pixel spacing

According to SimpleITK team[1], the bug exists with Fiji. According to the Fiji team[2], but bug exists with the bio-formats plugin.

[1] https://github.com/SimpleITK/SimpleITK/issues/438
[https://avatars1.githubusercontent.com/u/514960?s=400&v=4]<https://github.com/SimpleITK/SimpleITK/issues/438>

Show method does not preserve pixel spacing · Issue #438 · SimpleITK/SimpleITK<https://github.com/SimpleITK/SimpleITK/issues/438>
github.com
My expectation is that with the code below: import SimpleITK as sitk image = sitk.Image(64, 64, sitk.sitkFloat32) image.SetSpacing((2.0, 3.0)) sitk.Show(image) # Image shown in ImageJ has unity pix...


[2] https://github.com/fiji/fiji/issues/191
_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20180528/e447f5fd/attachment.html>


More information about the ome-users mailing list