Importing Tomovision Slice-O-Matic segmentations

Dear all,

My group has been using Tomovision Slice-O-Matic to create segmentations on CT-scans to get cross-sectional areas. I myself am using Slicer 3D for this and would like to use the segmentations created by others from Slice-O-Matic.

Slice-O-Matic creates a .tag file that contains the segmentation and this files is linked to a dicom file.
The contents of this TAG file is described here: SliceOmatic 5.0
It says the file is composed of a header and the image data. The image data is output as a binary format that is loosely based on the " university of Waterloo IM format"

Unfortunately, the normal import option (or add data) does not work for these kinds of files, so I would like to find another way to import these files.

I tried opening them in notepad++ or ImageJ to see if I could access this binary data to maybe convert this somehow to another format, but unfortunately I am not sufficiently knowledgeable on this subject to create a converter or to view the output somehow.

Is there anyone who has experience with this type of file format and is able to help me convert the tag files so that I can work with it in slicer?

Please find a link to a .dcm and corresponding .tag file (using anonymized data) in the link below

Thanks so much in advance for your help!

Best, Justin

It looks like there’s all the info you need, so just creating a .nhdr file the points to the .tag should make it basically loadable.

The nrrd format is described here. What I would suggest is starting with the dicom, creating a segmentation, saving it as .nhdr, and then editing the .nhdr data file field to point to the tag file. It might’ ‘just work’ or there may be other fields to tweak.

Hi Steve,

Thanks for your suggestion!

I’ve tried to do as you said, so create a segmentation and export as .nhdr
After opening the .nhdr file and changing the data file to point to the tag file I don’t get the expected result (if I add the .nhdr file to the scene nothing is added)

I also tried deleting the header information in the .tag file to see whether this is the problem but this doesn’t fix the problem.

What I notice is that the dummy segmentation is 3 kb (that I’ve created to change the header), the .dcm file is 254 kb and the .tag file is 257 kb. So it looks as if the .tag file contains the segmentation and the whole dicom image. Could that be possible?

Best, Justin

Yes, from what you posted the tag file should be the same size as the dicom since it is the same dimensions and datatype.

Probably there’s an error reported in the log file when you load the nhdr that will give you more info.

You might also use this extension to help narrow things down: GitHub - acetylsalicyl/SlicerRawImageGuess

Thanks! This is the error message I get:

Read: Error reading D:/Slicer/Test nhdr/Segmentation-Segment_1-label.nhdr:
[nrrd] nrrdLoad: trouble reading “D:/Slicer/Test nhdr/Segmentation-Segment_1-label.nhdr”
[nrrd] nrrdRead: trouble
[nrrd] _nrrdRead: trouble reading NRRD file
[nrrd] _nrrdFormatNRRD_read:
[nrrd] _nrrdEncodingGzip_read: expected 524288 bytes but received 262142

Algorithm vtkITKArchetypeImageSeriesScalarReader(000001B5C041FC80) returned failure for request: vtkInformation (000001B5C2C937E0)
Debug: Off
Modified Time: 736173
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA
FORWARD_DIRECTION: 0
ALGORITHM_AFTER_FORWARD: 1
FROM_OUTPUT_PORT: 0

ReadDataInternal: Cannot read file as a volume of type LabelMapVolume[fullName = D:/Slicer/Test nhdr/Segmentation-Segment_1-label.nhdr]
Number of files listed in the node = 0.
File reader says it was able to read 1 files.
File reader used the archetype file name of D:/Slicer/Test nhdr/Segmentation-Segment_1-label.nhdr [reader 0th file name = D:/Slicer/Test nhdr/Segmentation-Segment_1-label.nhdr]
FileFormatError

I’ve also tried using the Raw Image Guess.
When I set it to 8bit image, of dimensions 512x512 (CT-size) then the image turns white, however I cannot see the segmentations that are supposed to be there.

Edit: I also notice that when I open the ‘dummy segmentation’ file in Notepad++ it reads length 524.288 and the .tag file (with the header info removed) reads length 262.144. So this I can confirm from the error message.

The expected width en height of the image should be 512x512, as I can read this from the header of the .tag file.

Looks like you are close.

expected 524288 bytes but received 262142

means that the .tag has bytes instead of shorts so you need to change the nhdr to match.

You’ll want to load the converted file as a labelmap or segmentation. Also you can mouse over the image and look in the DataProbe (lower left) to see the pixel values that have been read.

If you use the .seg.nhdr extension then recent Slicer Releases (maybe only the preview release) will load the file by default as segmentation.

We have recently added the possibility to easily create custom file readers in Python and I wanted to give it a try to see how well it works. The result: it works very well and now there is a SliceOmatic tag file reader available in Slicer (in Sandbox extension).

If you install Sandbox extension (in Examples category in the Extensions manager) then you can load the .tag file directly as a segmentation by simply drag-and-dropping the file to the application window.

I only tested it on a single slice and single segment, but it should work on 3D data with multiple segments as well.

1 Like

I was finally able to use the Raw input guess method to generate a header for the .tag files after deleting the header information from the .tag file and convert to a segmentation (and as @lassoan advised also change the extension of the .nhdr to .seg.nhdr) but when I loaded the new header and the dicom file, the segmentation was not visible anymore.

The support for SliceOMatic tag import from the sandbox extension is amazing! I can just open the scan from the Dicom database, load in the segmentation by drag and drop and it falls into place nicely. Thanks so much for this extension!

1 Like