ImageJ Straighten avoid artefacts

Dear All,

cc @Alex_H

When applying ImageJ’s awesome Straighten... command in below image

run("Straighten...", "title=ClearedPlanula_Phalloidin_Hoechst-2.tif line=500 process");

There are regions where the data get significantly distorted (see second screenshot).

From just looking at the shape of the line ROI that should be straightened I somehow would not expect this. But maybe that really is the best transformation one can compute? I don’t have much experience with such operations and thus thought I ask here whether someone has an opinion or, even better, would know a way how to improve this.

Thank you so much for your time!
Tischi


Raw data

Image and line ROI: data.zip (1.4 MB)

Hi @Christian_Tischer
I noticed that I generally get better results after interpolating the source ROI to get much less control points and fitting a spline to it.
Jerome.

open("/Users/jmutterer/Downloads/data/ClearedPlanula_Phalloidin_Hoechst.tif");
selectWindow("ClearedPlanula_Phalloidin_Hoechst.tif");
open("/Users/jmutterer/Downloads/data/0281-0736-0719.roi");
run("Interpolate", "interval=200 smooth adjust");
run("Fit Spline");
run("Straighten...", "title=ClearedPlanula_Phalloidin_Hoechst-1.tif line=500");

3 Likes

The Straighten… command already implicitly fits a spline, so I wonder why this should be necessary.

Anyhow, thanks for sharing your observations!

2 Likes

@jerome Thanks a lot for looking into it! Your output seems to look nicer, indeed!

@imagejan & @jerome

I looked into the source code and, in fact, it seems to roi.removeSplineFit() and then do its own one again…

Indeed, commenting out the spline fit does not change the result for me:

rootDir = "/Users/tischer/Desktop/Desktop/data/"; 
open(rootDir + "ClearedPlanula_Phalloidin_Hoechst.tif");
selectWindow("ClearedPlanula_Phalloidin_Hoechst.tif");
open(rootDir + "0281-0736-0719.roi");
run("Interpolate", "interval=200 smooth adjust");
//run("Fit Spline");
run("Straighten...", "title=ClearedPlanula_Phalloidin_Hoechst-1.tif line=500");

Maybe there is a way to “burn in” the spline fit such that it becomes a set of control points that cannot be removed?!

Thank you very much for your great help! Yours, Soham and @Christian_Tischer

1 Like

Hi @Christian_Tischer ,

there is “Interpolate” (Edit > Selection >Interpolate) which could be used to burn the spline in.

2 Likes