I am Dan . My language is not English. if my English is difficult to understand,please tell me that. i rewrite about this.
【Assumptions / What I want to achieve】
I want to convert thic code(written in Macro.ijm by macro record) to Jpython.
### Written in Macro.ijm
open("C:/Users/For Programming/Documents/Python Scripts/ImageJtest/img064c.jpg");
run("RGB to CIELAB");
run("Stack to Images");
open("C:/Users/For Programming/Documents/Python Scripts/ImageJtest/img064cROI.zip");
roiManager("Open", "C:/Users/For Programming/Documents/Python Scripts/ImageJtest/img064cROI.zip");
selectWindow("a");
roiManager("Show All");
roiManager("Show All with labels");
roiManager("Measure");
selectWindow("L");
roiManager("Show All");
roiManager("Show All with labels");
roiManager("Measure");
selectWindow("b");
roiManager("Show All");
roiManager("Show All with labels");
roiManager("Measure");
saveAs("Results", "C:/Users/For Programming/Documents/Python Scripts/ImageJtest/Results.csv");
run("Close");
close();
close();
selectWindow("img064c.jpg");
close();
selectWindow("a");
close();
I can convert partially it to Python. (the following code)
from ij import IJ
from ij.plugin.frame import RoiManager
from ij.plugin.filter import ParticleAnalyzer, BackgroundSubtracter, EDM
from ij.measure import ResultsTable
from ij.io import DirectoryChooser
import os
imp = IJ.openImage("C:/Users/For Programming/Documents/Python Scripts/ImageJtest/img064c.jpg")
IJ.run(imp, "RGB to CIELAB", "")
IJ.run("Stack to Images", "")
imp2 = IJ.openImage("C:/Users/For Programming/Documents/Python Scripts/ImageJtest/img064cROI.zip")
RM = RoiManager()
rm = RM.getRoiManager()
rm.runCommand(imp2,"Show All")
selectWindow("L")
rm.runCommand(imp2,"Measure")
rm.runCommand(imp2,"Show All")
selectWindow("b")
rm.runCommand(imp2,"Measure")
rm.runCommand(imp2,"Show All")
selectWindow("a")
rm.runCommand(imp2,"Measure")
rm.runCommand(imp2,"Show All")
What is problem in solveing this
The code which i write in Python is not work perfectly. This cord dose work only
“Open the file” ,“RGB to CIELAB”, “Stack to Images” and “Open Roi Manager”.
The code dose not work “Select window” , “Measure”,“Show All”.
Please tell me how to work <selectWindow(“foo”);> , <roiManager(“Show All”);> ,
<roiManager(“Show All with labels”);> , <roiManager(“Measure”);> in python.