Here are the goals that I have:
1) I have many stained cells that I would like to cut out and then montage. I have the cells' Rois. 2) After I have a montage, I would like to create an overlay using the Rois from step 1. Any ideas would be appreciated. --------------------------------------- I used the following to obtain square images of the cells to montage: IJ.makeRectangle(); IJ.run("Duplicate...", "title"); IJ.run("Canvas Size...", "width= height= position="); // Select window iw = WindowManager.getImage("title").getWindow(); WindowManager.setCurrentWindow(iw); The problem that I am having is that there seems to be some threading going on that I am not fully aware of or am not handling correctly when I call the IJ commands..... I suspect that there is a threading problem because, when I run the program normally, I end up with cells that have been duplicated several times (total squares duplicated stays the same though), but, when I run the program in debug mode, I do not get this error. Thanks again! |
I probably should investigate the cause further, but, instead, I'll just say that IJ.makeRectangle() was causing the error. When I replaced IJ.makeRectangle() with custom code that should do the same thing, the program worked liked normal:
// Select window imp = WindowManager.getImage("DAPI"); imp.setActivated(); iw = imp.getWindow(); WindowManager.setCurrentWindow(iw); // Run IJ command //IJ.makeRectangle(xC - maxDim/2, yC - maxDim/2, maxDim, maxDim); // Create rectangle selection Rectangle tempRect = new Rectangle(xC - maxDim/2, yC - maxDim/2, maxDim, maxDim); iw.getImagePlus().setRoi(tempRect); // Select window imp = WindowManager.getImage("DAPI"); imp.setActivated(); iw = imp.getWindow(); WindowManager.setCurrentWindow(iw); // Run IJ command IJ.run("Duplicate...", "title=DAPI_" + yfpIndex);
|
I spoke too soon....replacing the IJ.makeRectangle command did not completely fix the problem. The only way that I have the program consistently working is by using this modified select command along with replacing the IJ.makeRectangle command.
// Select while(WindowManager.getCurrentWindow() != iwDAPI || WindowManager.getCurrentImage() != iwDAPI.getImagePlus()) WindowManager.setCurrentWindow(iwDAPI); If anyone has any idea about what is the underlying issue, I would really appreciate any advice offered. By the way, the reason I made the modified select command is because, I have some suspicions that this line of code isn't working quite like the designer had planned (or I'm not using the code the way the designer had planned). /** Makes the image contained in the specified window the active image. */ public static void setCurrentWindow(ImageWindow win) { if (win==null || win.isClosed() || win.getImagePlus()==null) // deadlock-"wait to lock" return;
|
Free forum by Nabble | Edit this page |