[Ilastik] Exporting traces as 2D contours

Hi all,

I have a question about exporting traces:

Specifically, I am looking to export all objects segmented by carving as series of 2D polylines or contours in a json wrapper that can be ported to some rendering/analysis pipeline I’m working on.

So, rather than exporting a stack of the binary contours from which I could determine and export the contours, is there a way to export traces as a series of 2D points-lists/contours within Ilastik already, or can you point me to the place in the source where I could go ahead and try to come up with my own function?

Thanks a lot,
Sam

Hey @Sam_Weiser_Novak,

such a list is not readily available from within ilastik. However, what you can get is the result of meshing it via the marching cubes algorithm by pressing the Export all Meshes button :

export_obj

Maybe those meshes (in .obj format) are already helpful. From the meshes it should be also straight forward to create contours by cutting them with planes (something like this is available e.g. in vtk).

Cheers
Dominik

Thanks for the reply @k-dominik.

However, I want to use a different method to generate 3D volumes from the 2D slabs than the one that Ilastik generates. If I’m not mistaken, you’re suggesting that I render a 3D mesh and then reslice it? That is an extra step and does not accomplish what I want to do - sorry for not being clear enough in my original post.

I know how to export the traces for individual objects (by right clicking on the labels and exporting them):

image

What I want is to understand how these trace files are generated, so that I can work towards instead generating polylines/contours and export these values in a JSON string for further processing in a different piece of software.

I would appreciate any insight into writing a custom export protocol.

Thanks again,
Sam

Can someone please let me know how I can learn more about the numpy output formatting?

https://www.ilastik.org/documentation/basics/headless

Thanks,
Sam

Hey @Sam_Weiser_Novak

okay, If you want to go through this contouring part yourself, just export the completed segments (one color per object) layer. You will get the object masks in 3D with one specific value per object. Reslicing will easily give you the individual 2D slices then.

In your second post you’re referring to the Headless docs. In carving there is no headless mode possible due to it’s semi-automatic nature. Anything else should be configurable from the export dialog.

Cheers
Dominik

Is there some sort of macro or API method to implement my own export function within the software without the extra steps of exporting the stack and calculating the contours separately? It should be a really simple process in Python. Also, I exported my traces as a .npy (Numpy) file but I’m having trouble reading it - I’ll make a smaller test trace soon, but I’m wondering if anyone can explain the Numpy output format/syntax.

Thanks for your help, I will definitely be starting with exporting traces and generating contours in a separate program for now.

Cheers,

Sam

As of right now, there is no way to automate things with macros and so far this feature has not been heavily requested, I’m afraid. But we’re an open source project and welcome contributions :wink:

in order to load an npy-file:

import numpy

myarray = numpy.load('my-filename.npy')