Straightening
Once your images are segmented, you might want to computationally straighten your objects of interest (worms, pharynxes, etc.). This greatly simplifies the morphology analysis, by for example allowing you to compute the volume of the worms by assuming rotational symmetry. To get a good straigthened image, the first step it to get very good segmentation masks (refer to segmentation).
Options¶
straightening_source: The images that will be straightened. The first element of the list is the column of the csv file you want to process, the second element is the channel(s) you want to straighten. This image can be your raw image but could also be the segmentation masks themselves. (e.g. [ ‘analysis/ch1_seg’, null ], or [ ‘raw’, [ 0 ] ], or [ ‘raw’, [ 0, 1 ] ])
straightening_masks: The masks that will be used to straighten the source image. (e.g. ‘analysis/ch1_seg’)
Example¶
Let’s say that in previous blocks we segmented the first and second channel of our images. This would create two new columns in the experiment’s filemap :
analysis/ch1_seganalysis/ch2_seg
If you wanted to straighten those masks (for studying morphology) and the raw images (for visualization or quantifying fluorescence), here is a configuration you could use :
building_blocks: ["straightening", "straightening", "straightening", "straightening"]
straightening_source: [['analysis/ch2_seg', null], ['analysis/ch1_seg', null], ['raw', [1]], ['raw', [0]]]
straightening_masks: ['analysis/ch2_seg', 'analysis/ch1_seg', "analysis/ch2_seg", "analysis/ch1_seg"]As you can see, you would need 4 straightening blocks as those are 4 different atomic straightening tasks. The mask images contain no channels, so the second part of straightening_source can be null.
This would create 4 new sub directories in analysis/ and 4 new columns in your filemap :
analysis/ch2_seg_stranalysis/ch1_seg_stranalysis/ch2_raw_stranalysis/ch1_raw_str
If possible, it’s in general always better to straighten the the mask or raw channel with the mask that was extracted from it. In some cases this is not possible (for example, the germline of later stage worms is made of two separate objects), so you should straightening them using another mask (for example, the body mask).
3D reconstruction¶
When running on stacks, the straightening algorithm automatically performs plane-to-plane registration of the straightened planes. Assuming you have good segmentation masks at every plane, the straightening will output a nicely 3D reconstructed image, even if the worm moves or bends in between planes. This naturally also works if the image is a movie instead of a Z-stack.