We are having a problem converting hyperstacks to RGB in a macro. Approximately one out of five times we run the macro, it does not work. We tried adding a wait(200) step, but don't know if this really helps or not.
The error is that ImageJ cannot find image with id2. [cid:image001.png@01D28EBA.CC7A15E0] Any help appreciated. The problem is with the second macro. Included the first macro to show what types of files we are using (2 or 3 channel Z series confocal). macro "Set up images [q]" { //run("Channels Tool..."); Stack.setDisplayMode("composite"); //run("Brightness/Contrast..."); Stack.getDimensions(width, height, channels, slices, frames) ; for (n=1; n<=channels; n++) { Stack.setChannel(n); setMinAndMax(0, 65535); } Stack.setSlice(floor(slices / 3)) ; } /* Draw a box around an area to be 3D projected. Run this macro. */ macro "Do 3D projections [F2]" { run("Duplicate...", "duplicate"); id1 = getImageID(); // change to get scale for each sample if Z different than 0.3 um run("3D Project...", "projection=[Brightest Point] axis=X-Axis slice=0.30 initial=0 total=360 rotation=10 lower=1 upper=255 opacity=0 surface=50 interior=25 interpolate"); //run("RGB Color", "frames"); // buggy wait(200); // appears the projection command needs this to hand off the image properly id2 = getImageID(); run("RGB Color", "frames keep"); selectImage(id1); close(); selectImage(id2); close(); } =*===========================================================*= Michael Cammer, DART Microscopy Laboratory, NYU Langone Medical Center Cell: 914-309-3270 Office: Skirball 2nd Floor main office, back right http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html image001.png (8K) Download Attachment |
Hi Michael,
On my system, this failed every time. The debug window showed id1 and id2 to be the same — even though the projection window was on top. A workaround, which you probably already considered, is to find the projection by the window title. The below macro works for me. I added a line to make a test hyperstack in the first step. macro "Set up images [q]" { // create an image to process newImage("HyperStack", "16-bit color-mode label", 300, 300, 3, 10, 1); //run("Channels Tool..."); Stack.setDisplayMode("composite"); //run("Brightness/Contrast..."); Stack.getDimensions(width, height, channels, slices, frames) ; for (n=1; n<=channels; n++) { Stack.setChannel(n); setMinAndMax(0, 65535); } Stack.setSlice(floor(slices / 3)) ; } /* Draw a box around an area to be 3D projected. Run this macro. */ macro "Do 3D projections [F2]" { run("Duplicate...", "duplicate"); id1 = getImageID(); title = getTitle(); // change to get scale for each sample if Z different than 0.3 um run("3D Project...", "projection=[Brightest Point] axis=X-Axis slice=0.30 initial=0 total=360 rotation=10 lower=1 upper=255 opacity=0 surface=50 interior=25 interpolate"); //run("RGB Color", "frames"); // buggy wait(200); // appears the projection command needs this to hand off the image properly selectWindow("Projections of " + title); id2 = getImageID(); run("RGB Color", "frames keep"); selectImage(id1); close(); selectImage(id2); close(); } On Feb 24, 2017, at 4:26 PM, Cammer, Michael <[hidden email]<mailto:[hidden email]>> wrote: We are having a problem converting hyperstacks to RGB in a macro. Approximately one out of five times we run the macro, it does not work. We tried adding a wait(200) step, but don't know if this really helps or not. The error is that ImageJ cannot find image with id2. [cid:image001.png@01D28EBA.CC7A15E0] Any help appreciated. The problem is with the second macro. Included the first macro to show what types of files we are using (2 or 3 channel Z series confocal). macro "Set up images [q]" { //run("Channels Tool..."); Stack.setDisplayMode("composite"); //run("Brightness/Contrast..."); Stack.getDimensions(width, height, channels, slices, frames) ; for (n=1; n<=channels; n++) { Stack.setChannel(n); setMinAndMax(0, 65535); } Stack.setSlice(floor(slices / 3)) ; } /* Draw a box around an area to be 3D projected. Run this macro. */ macro "Do 3D projections [F2]" { run("Duplicate...", "duplicate"); id1 = getImageID(); // change to get scale for each sample if Z different than 0.3 um run("3D Project...", "projection=[Brightest Point] axis=X-Axis slice=0.30 initial=0 total=360 rotation=10 lower=1 upper=255 opacity=0 surface=50 interior=25 interpolate"); //run("RGB Color", "frames"); // buggy wait(200); // appears the projection command needs this to hand off the image properly id2 = getImageID(); run("RGB Color", "frames keep"); selectImage(id1); close(); selectImage(id2); close(); } =*===========================================================*= Michael Cammer, DART Microscopy Laboratory, NYU Langone Medical Center Cell: 914-309-3270 Office: Skirball 2nd Floor main office, back right http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html ------------------------------------ Theresa Swayne, Ph.D. Manager Confocal and Specialized Microscopy Shared Resource<http://hiccc.columbia.edu/research/sharedresources/confocal> Herbert Irving Comprehensive Cancer Center Columbia University Medical Center 1130 St. Nicholas Ave., Room 222A New York, NY 10032 Phone: 212-851-4613 [hidden email]<mailto:[hidden email]> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Cammer, Michael
> On Feb 24, 2017, at 4:26 PM, Cammer, Michael <[hidden email]> wrote:
> > We are having a problem converting hyperstacks to RGB in a macro. Approximately one out of five times we run the macro, it does not work. We tried adding a wait(200) step, but don't know if this really helps or not. Hi Michael, The latest ImageJ daily build (1.51k21) fixes a bug in the 3D Project… command that was causing your macro to fail. The 200 ms wait is not needed. -wayne > The error is that ImageJ cannot find image with id2. > > [cid:image001.png@01D28EBA.CC7A15E0] > > Any help appreciated. The problem is with the second macro. Included the first macro to show what types of files we are using (2 or 3 channel Z series confocal). > > macro "Set up images [q]" { > //run("Channels Tool..."); > Stack.setDisplayMode("composite"); > //run("Brightness/Contrast..."); > Stack.getDimensions(width, height, channels, slices, frames) ; > for (n=1; n<=channels; n++) { > Stack.setChannel(n); > setMinAndMax(0, 65535); > } > Stack.setSlice(floor(slices / 3)) ; > } > > /* Draw a box around an area to be 3D projected. > Run this macro. > */ > macro "Do 3D projections [F2]" { > run("Duplicate...", "duplicate"); > id1 = getImageID(); > // change to get scale for each sample if Z different than 0.3 um > run("3D Project...", "projection=[Brightest Point] axis=X-Axis slice=0.30 initial=0 total=360 rotation=10 lower=1 upper=255 opacity=0 surface=50 interior=25 interpolate"); > //run("RGB Color", "frames"); // buggy > wait(200); // appears the projection command needs this to hand off the image properly > id2 = getImageID(); > run("RGB Color", "frames keep"); > selectImage(id1); close(); selectImage(id2); close(); > } > > > > > > > > > =*===========================================================*= > Michael Cammer, DART Microscopy Laboratory, NYU Langone Medical Center > Cell: 914-309-3270 Office: Skirball 2nd Floor main office, back right > http://ocs.med.nyu.edu/microscopy & http://microscopynotes.com/ > > > ------------------------------------------------------------ > This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. > ================================= > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thank you!!!
_________________________________________ Michael Cammer, Optical Microscopy Specialist http://ocs.med.nyu.edu/microscopy http://microscopynotes.com/ Cell: (914) 309-3270 ________________________________________ From: Wayne Rasband [[hidden email]] Sent: Saturday, February 25, 2017 8:03 PM To: [hidden email] Subject: Re: problem with conversion to RGB - IJ 1.51k18 java 1.6.0_20 > On Feb 24, 2017, at 4:26 PM, Cammer, Michael <[hidden email]> wrote: > > We are having a problem converting hyperstacks to RGB in a macro. Approximately one out of five times we run the macro, it does not work. We tried adding a wait(200) step, but don't know if this really helps or not. Hi Michael, The latest ImageJ daily build (1.51k21) fixes a bug in the 3D Project… command that was causing your macro to fail. The 200 ms wait is not needed. -wayne > The error is that ImageJ cannot find image with id2. > > [cid:image001.png@01D28EBA.CC7A15E0] > > Any help appreciated. The problem is with the second macro. Included the first macro to show what types of files we are using (2 or 3 channel Z series confocal). > > macro "Set up images [q]" { > //run("Channels Tool..."); > Stack.setDisplayMode("composite"); > //run("Brightness/Contrast..."); > Stack.getDimensions(width, height, channels, slices, frames) ; > for (n=1; n<=channels; n++) { > Stack.setChannel(n); > setMinAndMax(0, 65535); > } > Stack.setSlice(floor(slices / 3)) ; > } > > /* Draw a box around an area to be 3D projected. > Run this macro. > */ > macro "Do 3D projections [F2]" { > run("Duplicate...", "duplicate"); > id1 = getImageID(); > // change to get scale for each sample if Z different than 0.3 um > run("3D Project...", "projection=[Brightest Point] axis=X-Axis slice=0.30 initial=0 total=360 rotation=10 lower=1 upper=255 opacity=0 surface=50 interior=25 interpolate"); > //run("RGB Color", "frames"); // buggy > wait(200); // appears the projection command needs this to hand off the image properly > id2 = getImageID(); > run("RGB Color", "frames keep"); > selectImage(id1); close(); selectImage(id2); close(); > } > > > > > > > > > =*===========================================================*= > Michael Cammer, DART Microscopy Laboratory, NYU Langone Medical Center > Cell: 914-309-3270 Office: Skirball 2nd Floor main office, back right > http://ocs.med.nyu.edu/microscopy & https://urldefense.proofpoint.com/v2/url?u=http-3A__microscopynotes.com_&d=DQIFaQ&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_vAdjXk3frDLx_CqKkuo&m=zMi2MImiqqSoL2uyrKtI4I5bqy1bpH_THjn82Cx3bKY&s=JmZUD6MpOIBQIL0gfrGQIvQToAvee28w5IMwhZQLfDM&e= > > > ------------------------------------------------------------ > This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. > ================================= > > -- > ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DQIFaQ&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_vAdjXk3frDLx_CqKkuo&m=zMi2MImiqqSoL2uyrKtI4I5bqy1bpH_THjn82Cx3bKY&s=vwitU8jEBmNJsGawiJDAM0Y5_eW3THHPk8aCgVG_sb0&e= -- ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DQIFaQ&c=j5oPpO0eBH1iio48DtsedbOBGmuw5jHLjgvtN2r4ehE&r=oU_05LztNstAydlbm5L5GDu_vAdjXk3frDLx_CqKkuo&m=zMi2MImiqqSoL2uyrKtI4I5bqy1bpH_THjn82Cx3bKY&s=vwitU8jEBmNJsGawiJDAM0Y5_eW3THHPk8aCgVG_sb0&e= ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |