Ilastik: Changing orientation of raw data, keeping training labels

I have been using a raw data stack of JPEG images served over HTTP for a 2-stage autocontext workflow. We’ve now got the same data at full resolution in N5, which ilastik supports (awesome!), so I’d like to use that. However, the JPEG stack worked in xytc, and the N5 volume is tyxc (t is actually z, but it’s easier to use t as I’m working in 2D anyway).

I would like to switch over to the N5, but I would like to keep my training labels. Looking at the ILP file, the label block extents (originally drawn on the JPEG stacks) have been normalised to tyxc order, so I would expect them to work (I’m assuming everything uses vigra tagged axes under the hood), but I can’t see any of the training labels if I just delete the JPEG raw and add the N5 raw.

Hi @clbarnes,

I just tried to reproduce this. So what I did is, I generated two h5 files with different axisordering, loaded the first one, made some annotations and then went back to the Data Selection applet and right clicked, selected replace with file , chose the other one and, well it just worked.
Did you do the same? Or did you first remove the dataset and added another one (as two separate steps)?

As a kind of workaround/last resort, you can try exporting the labels to a file first (in the Training applet, right click on the Labels layer, choose export), and then later importing them with the new data (same procedure as exporting, but choose import).

Ah, I didn’t see the replace option. I’ll give that a try! I actually got a project file to work in the GUI eventually by creating an empty ILP with the new raw data, then grafting the Input Data group from that hdf5 file into the existing project and deleting the trained classifiers, but I’ll go back and do it the sensible way!

Exporting the labels seemed to be taking a very long time; I am working in a 3TB volume with 10 fairly small regions of labels so I suspect it was copying a lot of zeros rather than just picking out the labelled regions.

P.S. my other issue re. the python API came up before I started messing with the project file so they’re unrelated.

That file replacement isn’t working for me - it may be due to the handling of the tiled volume description JSON. The JSON file encodes describes 3D elements (e.g. bounds) in ZYX, and 2D elements (tile dimensions) in YX, but the output_axes field is “xyz”; ilastik then converts the axes to XYZC by default, which I then edited in the GUI to XYTC. N5 then has a quirk that it encodes its own dimensionality in Fortran order (XYZ), but z5py transposes everything to be in C order (ZYX), which I actually want to treat as TYX, and which ilastik would prefer to be TYXC.

… I guess it’s fair enough that there are going to be problems.

I actually got a project file to work in the GUI eventually by creating an empty ILP with the new raw data, then grafting the Input Data group from that hdf5 file into the existing project and deleting the trained classifiers

This approach worked well enough that the GUI could use it to train a classifier and predict pixels using those classifiers. If I can get that far, do you anticipate any other issues?

Not that I can think of any. I assume you just saved an empty autocontext .ilp for that and just modified/added the image and labels?