I’m trying to use Elastic Stack Alignment (ESA) algorithm from Trakem2 to apply transformation to binary mask images but the output images are completely black. The goal is to be able to use the method to register some images and apply the same transformations to binary mask images that contain regions of interest in the images. Registration works well producing registered images and a project xml file with the transformations.
I have a script that takes this project file and some mask images and modifies the project file by changing file names, titles and z coordinates to match the inputted mask images. This works fine for some registrations & masks but for some it doesn’t. When it doesn’t, the mask images contain only zeroes and all the white (255) is missing. And when this happens, no errors relating to this is shown in the log files, and execution succeeds as if everything is ok (There are some other errors, e.g. null pointer exception but this occurs also when the outputted mask images are fine so believe this is not related to the issue).
I made an experiment where the same mask images didn’t work with one project file but gave good outputs on other, so it seems the issue is not in the input images but perhaps in the modified project file. I compared these two project files with a diff tool and tried to manually make the failing project file more similar with the succeeding one but the output images where always black.
I have included an example code that reprocduces the error.
Structure of the zip is as follows:
│ ├── preprocessed : input mask images
│ └── reapplied : output directory for transformed masks
├── Modified_tempproject.xml : modified project file
├── params.txt : ESA parameters used in registration
├── reapply : bash script to call reapply.py. Just run ./reapply
├── reapply.py : jython script to apply transformation to mask images
└── tempproject.xml : original unmodified project file
Download link: https://www.dropbox.com/s/43t9tg231hdxc44/code.zip?dl=0
The script is written in Jython and Fiji has version 2.0.0-rc-64/1.51s.
Next I will probably try to open the project with Fiji GUI to spot any issues and export the masks from there. If this doesn’t help, I’ll try to use a debugger to find out if the ImagePlus object contain any data before exporting to further narrow down the issue. What could be the issue here? Any ideas are welcome.