You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to generate Geodesic Distance Map (GDM) for a series of of 2D masks stored in a 3D stack, together with a marker stack of the same dimensions. What I noticed is that if I perform anything with the GDM output image before closing it, the for loop would just exit after the first slice. Here is my simple IJ macro script:
mask = "motion_compen_mask.tif";
marker = "Mask3d.tif";
selectWindow(mask);
print(nSlices);
for (i=0; i<nSlices; i++) {
print(i);
selectWindow(mask);
setSlice(i+1);
selectWindow(marker);
setSlice(i+1);
run("Geodesic Distance Map", "marker="+marker+" mask="+mask+" distances=[Chessknight (5,7,11)] output=[32 bits] normalize");
gdwindow = getTitle();
// If I do anything here before closing the GDM output window, the for loop would just exit after i=0// For example, a simple duplication of the GDM output would make it exit after i=0:run("Duplicate...", "title=dup");
// If you comment out the above line, the for loop would run throughprint("here");
close(gdwindow);
// If close() is not called here, the for loop would also exit after i=0, no matter if anything was done to gdwindow
}
print("loop exited");
Could this a be a bug or by design? I'm attaching a ZIP file with the two TIFF files used in this script. Thank you very much!
Yes, exactly! My plan was to duplicate the GDM result into another window for the 1st slice, and then append the results from subsequent slices to this window to form a 3D stack of 2D-GDM results.
I found a work-around since the first posting: after each slice's processing, I could save the result into a TIFF (i.e., one TIFF per slice) without interrupting the for loop, and then import the 2D TIFFs as a sequence. But of course it'd be nicer to not have to have this intermediate step.
Forgot to mention that I have an almost identical experience with applying Marker-Controlled Watershed (MCW) on a series of 2D slices from 3D stacks input. And the same saving-result-into-one-TIFF-per-slice workaround works. The only difference is that for MCW to work in 2D mode with 3D stacks as inputs, I had to duplicate the slices of the same slice# from the input stacks and use the those slices as input to MCW; just setSlice(i+1) wouldn't be enough, which is fine.
Hello MorphoLibJ developers,
I'm trying to generate Geodesic Distance Map (GDM) for a series of of 2D masks stored in a 3D stack, together with a marker stack of the same dimensions. What I noticed is that if I perform anything with the GDM output image before closing it, the
for
loop would just exit after the first slice. Here is my simple IJ macro script:Could this a be a bug or by design? I'm attaching a ZIP file with the two TIFF files used in this script. Thank you very much!
--lin
tiffs.zip
The text was updated successfully, but these errors were encountered: