Is there a way we can convert and export our NRRD files as a TIFF stack without exporting to imageJ/IrfanView afterwards to convert the format from DICOM to a TIFF image series? If not, this seems like something we should have, since the major file format for MorphoSource uploads is a TIFFstack…
That’s really a MOrphoSource problem, not a Slicer one.
TIFF (or any other 2D format) is not a good format to retain 3D data, particularly for archival purposes. The lack of standardized metadata to describe image spacing, image coordinate system make those formats problematic. We explained this to MorphoSource team multiple times, and while they seem to appreciate the problem, they don’t seem to be willing to act on it.
At this point there is no interest in the Slicer core team to take a NRRD file and convert into an 2D image sequence, since it will create a whole lot of can of worms and possibly degrade the data quality as well.
Having that, there is nothing to stop someone to write a short python script that will iterate over the image numpy array and write them as a series of 2D images. It is not difficult, in fact all necessary python functions are probably documented in the Slicer script repository.
Thanks for the quick answer Murat. I’m trying to walk a 3D Slicer user through uploading their data to MS, so I’ll direct them to conversion outside of the Slicer environment for now.
By the way, if you want to see how unpredictable this can be:
- Download the MRHead dataset
- Click ctrl+S and bring up the save as dialog box and choose the format of TIFF. This will save the file as a multiframe tiff (a single tiff image, with slices)
- Load that data into Slicer and see that orientaton and spacing is incorrect.
I suggested the MorphoSource team to collaborate on data exporter from Slicer for this specific use case. That way it would have been possible to control some of the things, but they don’t seem to be interested in that either.
At SlicerAutoscoperM, we also deal with TIFF being necessary input to existing software (Autoscoper)
Jaimi, you may find some of our module functions helpful.
Hi Murat, wouldn’t it be feasible to export an nrrd as a tiff stack with a metadata file in the same folder (similar to metadata files exported during recon from projections to tiff stacks)? I’d imagine the relevant info could be retained and recognized by Slicer during subsequent import of the converted tiff stack, just like it is for importing a reconstructed tiff stack. I quickly wrote a little python script (GitHub nrrd2tiff) to do the conversion and copy over metadata info both from the original scanner metadata file and from the header of the nrrd. I’d love to develop it a bit further to make sure all the relevant information is retained, if you have any advice.
No, not really. That’s poor data management. There are many issues: What is the convention of that file, what fields there would be, what are the units, what format (csv, tab, json, xml?), which reader is going to read all that? Most programs will see a tiff file and completely ignore that file. There is already a well documented, open formats that covers all of that situation, why re-invent the wheel.
As I said, all the necessary functionality to do that exists, we just don’t want to have it as a core feature of Slicer.
Looks good to me. I would suggest reloading your new tiff sequence back into Slicer and double checking that it is indeed complete and consistent with the original data.
Thanks for the quick response. So far, the datasets I’ve tried seem consistent upon reimport to Slicer, but I will keep verifying before I apply it to all ~130 of the datasets I still need to upload to MorphoSource. Completely understood that converting Nrrd’s to Tiff’s is not an ideal solution for data management best practices, but for those of us that want to use 3D Slicer and upload our datasets to MorphoSource, I don’t see an alternative.
I understand that, it is a MorphoSource requirement. But what we don’t want to encourage is to use of those formats as primary mean to keep the image data. If you want test, do this:
Crop your original NRRD file and/or put it under a transform. Save it as a new NRRD file, then export your NRRD file your script as your TIFF sequence. Then reload both of them into the Slicer. I suspect your tiff file no longer will have the correct orientation and the origin of the modified NRRD.
That’s what we want to avoid.
Indeed, the orientation and origin are different for the cropped Nrrd and original. If you all were willing to add a feature to simplify the process for those of us wanting to upload to MorphoSource, it seems like optional form fields in the ImageStacks module for origin, pixel size, height/width/no images would correct for this loss of information. Totally understood that you all don’t want to open this can of worms, though. Thanks for the info, it’s been helpful and interesting.