I have the following image:
What I wanted to do is to convert it into CIELab stack and then extract 2nd slice (a*).
I have this code:
from ij import IJ infile = "/Users/gundalav/Desktop/my_image.png" imp = IJ.openImage(infile) # Duplicate imp2 = imp.duplicate() imp2.show() # IJ.run(imp2, "HSB Stack", "") # This is working IJ.run(imp2, "Lab Stack", "") # But not this imp2.setSlice(1) IJ.run(imp2, "Delete Slice", "") imp2.setSlice(2) IJ.run(imp2, "Delete Slice", "")
The code failed to do what I intended. In particular this line
IJ.run(imp2, "Lab Stack", "").
That line was obtained from
Plugins> Macro > Records .
What’s the right way to do it?
Typically I’d execute using Terminal command line:
$ /Applications/Fiji.app/Contents/MacOS/ImageJ-macosx mycode.py
Note that “HSB stack” works with the above Python macro.