Dear all,
I have an ImagePlus for which lines (= drawLine(int x1, int y1, int x2, int y2))are drawn on its ImageCanvas. How is it possible to make a kind of flatten of these drawn lines in order to be able to save them on top of the ImagePlus? I thank you very much in advance for your help. My best regards, Philippe Philippe CARL Laboratoire de Biophotonique et Pharmacologie UMR 7213 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 41 84 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Philippe,
I believe the easiest way is to simply call the “flatten” method of the corresponding ImagePlus instance: https://imagej.nih.gov/ij/developer/api/ij/ImagePlus.html#flatten-- Cheers, John > On Nov 24, 2016, at 9:25 AM, Philippe CARL <[hidden email]> wrote: > > Dear all, > > I have an ImagePlus for which lines (= drawLine(int x1, int y1, int x2, int > y2))are drawn on its ImageCanvas. > > How is it possible to make a kind of flatten of these drawn lines in order > to be able to save them on top of the ImagePlus? > > I thank you very much in advance for your help. > > My best regards, > > Philippe > > > > Philippe CARL > > Laboratoire de Biophotonique et Pharmacologie > > UMR 7213 CNRS - Université de Strasbourg > > Faculté de Pharmacie > > 74 route du Rhin > > 67401 ILLKIRCH > > Tel : +33(0)3 68 85 41 84 > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear John,
I had already tried it, and it wasn't working. Unfortunately... My best regards, Philippe Le Jeudi 24 Novembre 2016 15:33 CET, John Hayes <[hidden email]> a écrit: > Hi Philippe, > > I believe the easiest way is to simply call the “flatten” method of the corresponding ImagePlus instance: > https://imagej.nih.gov/ij/developer/api/ij/ImagePlus.html#flatten-- > > Cheers, > John > > > On Nov 24, 2016, at 9:25 AM, Philippe CARL <[hidden email]> wrote: > > > > Dear all, > > > > I have an ImagePlus for which lines (= drawLine(int x1, int y1, int x2, int > > y2))are drawn on its ImageCanvas. > > > > How is it possible to make a kind of flatten of these drawn lines in order > > to be able to save them on top of the ImagePlus? > > > > I thank you very much in advance for your help. > > > > My best regards, > > > > Philippe > > > > > > > > Philippe CARL > > > > Laboratoire de Biophotonique et Pharmacologie > > > > UMR 7213 CNRS - Université de Strasbourg > > > > Faculté de Pharmacie > > > > 74 route du Rhin > > > > 67401 ILLKIRCH > > > > Tel : +33(0)3 68 85 41 84 > > > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Can you post a simple example of your code then? Also, if you show your ImagePlus in the GUI and use the “Flatten” command from the Image->Overlay menu, does that work? Last idea: if your ImagePlus contains a stack/hyperstack, you may have to use the ImagePlus::flattenStack command.
John > On Nov 24, 2016, at 10:45 AM, CARL Philippe (PHA) <[hidden email]> wrote: > > Dear John, > I had already tried it, and it wasn't working. Unfortunately... > My best regards, > Philippe > > Le Jeudi 24 Novembre 2016 15:33 CET, John Hayes <[hidden email]> a écrit: > >> Hi Philippe, >> >> I believe the easiest way is to simply call the “flatten” method of the corresponding ImagePlus instance: >> https://imagej.nih.gov/ij/developer/api/ij/ImagePlus.html#flatten-- >> >> Cheers, >> John >> >>> On Nov 24, 2016, at 9:25 AM, Philippe CARL <[hidden email]> wrote: >>> >>> Dear all, >>> >>> I have an ImagePlus for which lines (= drawLine(int x1, int y1, int x2, int >>> y2))are drawn on its ImageCanvas. >>> >>> How is it possible to make a kind of flatten of these drawn lines in order >>> to be able to save them on top of the ImagePlus? >>> >>> I thank you very much in advance for your help. >>> >>> My best regards, >>> >>> Philippe >>> >>> >>> >>> Philippe CARL >>> >>> Laboratoire de Biophotonique et Pharmacologie >>> >>> UMR 7213 CNRS - Université de Strasbourg >>> >>> Faculté de Pharmacie >>> >>> 74 route du Rhin >>> >>> 67401 ILLKIRCH >>> >>> Tel : +33(0)3 68 85 41 84 >>> >>> >>> -- >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by CARL Philippe (LBP)
Hi Philippe,
mind that ImagePlus.flatten returns a flattened ImagePlus, it does not modify the original. Or could it be that you want the opposite of 'flatten'? 'flatten' writes the lines and other objects currently present as overlay into the image, modifying the image data. 'drawLine' (ImageProcessor, not ImageCanvas method) irreversibly draws a line by modifying the pixels. The same is true for the macro drawLine command (not for macro Overlay.drawLine). You cannot convert that into an overlay any more, and you cannot recover the pixel data that were overwritten. Michael ________________________________________________________________ On 2016-11-24 16:45, CARL Philippe (PHA) wrote: > Dear John, > I had already tried it, and it wasn't working. Unfortunately... > My best regards, > Philippe > > Le Jeudi 24 Novembre 2016 15:33 CET, John Hayes <[hidden email]> a écrit: > >> Hi Philippe, >> >> I believe the easiest way is to simply call the “flatten” method of the corresponding ImagePlus instance: >> https://imagej.nih.gov/ij/developer/api/ij/ImagePlus.html#flatten-- >> >> Cheers, >> John >> >>> On Nov 24, 2016, at 9:25 AM, Philippe CARL <[hidden email]> wrote: >>> >>> Dear all, >>> >>> I have an ImagePlus for which lines (= drawLine(int x1, int y1, int x2, int >>> y2))are drawn on its ImageCanvas. >>> >>> How is it possible to make a kind of flatten of these drawn lines in order >>> to be able to save them on top of the ImagePlus? >>> >>> I thank you very much in advance for your help. >>> >>> My best regards, >>> >>> Philippe >>> >>> >>> >>> Philippe CARL >>> >>> Laboratoire de Biophotonique et Pharmacologie >>> >>> UMR 7213 CNRS - Université de Strasbourg >>> >>> Faculté de Pharmacie >>> >>> 74 route du Rhin >>> >>> 67401 ILLKIRCH >>> >>> Tel : +33(0)3 68 85 41 84 >>> >>> >>> -- >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by John Hayes
Hi Philippe from across Strasbourg.
Maybe look at the screen grabber code : https://imagej.nih.gov/ij/source/ij/plugin/ScreenGrabber.java Jerome. On 24 November 2016 at 16:52, John Hayes <[hidden email]> wrote: > Can you post a simple example of your code then? Also, if you show your > ImagePlus in the GUI and use the “Flatten” command from the Image->Overlay > menu, does that work? Last idea: if your ImagePlus contains a > stack/hyperstack, you may have to use the ImagePlus::flattenStack command. > > John > > > On Nov 24, 2016, at 10:45 AM, CARL Philippe (PHA) < > [hidden email]> wrote: > > > > Dear John, > > I had already tried it, and it wasn't working. Unfortunately... > > My best regards, > > Philippe > > > > Le Jeudi 24 Novembre 2016 15:33 CET, John Hayes <[hidden email]> a > écrit: > > > >> Hi Philippe, > >> > >> I believe the easiest way is to simply call the “flatten” method of the > corresponding ImagePlus instance: > >> https://imagej.nih.gov/ij/developer/api/ij/ImagePlus.html#flatten-- > >> > >> Cheers, > >> John > >> > >>> On Nov 24, 2016, at 9:25 AM, Philippe CARL <[hidden email]> > wrote: > >>> > >>> Dear all, > >>> > >>> I have an ImagePlus for which lines (= drawLine(int x1, int y1, int > x2, int > >>> y2))are drawn on its ImageCanvas. > >>> > >>> How is it possible to make a kind of flatten of these drawn lines in > order > >>> to be able to save them on top of the ImagePlus? > >>> > >>> I thank you very much in advance for your help. > >>> > >>> My best regards, > >>> > >>> Philippe > >>> > >>> > >>> > >>> Philippe CARL > >>> > >>> Laboratoire de Biophotonique et Pharmacologie > >>> > >>> UMR 7213 CNRS - Université de Strasbourg > >>> > >>> Faculté de Pharmacie > >>> > >>> 74 route du Rhin > >>> > >>> 67401 ILLKIRCH > >>> > >>> Tel : +33(0)3 68 85 41 84 > >>> > >>> > >>> -- > >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > >> > >> -- > >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > > > > > > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- Jerome Mutterer CNRS - Institut de biologie moléculaire des plantes 12, rue du Général Zimmer 67084 Strasbourg Cedex www.ibmp.cnrs.fr -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by CARL Philippe (LBP)
Dear all,
Thanks a lot for your answers on my question. Jérôme: I had previously found the "Plugins->Utilities->Capture-Image" feature, but from looking at the code on the link you indicated, I better understand how it is actually working. Thus I was able to successfully write a code that is then using this plugin. But very unfortunately, in order to correctly work, the pictures to be captured need to be on the foreground. And thus in the case you try for example to write an E-mail while your analysis is running in the background, you will finally finish up with a copy of your mail which is quite uncool. Michael: I wasn't aware of the content of your mail. Following it, I will try to write a new method that will be applying the drawLine directly on the ImagePlus. John: the code I want to work on is the generateView void within the Particle_Tracker plugin of http://mosaic.mpi-cbg.de/?q=downloads My best regards, Philippe -----Message d'origine----- De : ImageJ Interest Group [mailto:[hidden email]] De la part de Jerome Mutterer Envoyé : jeudi 24 novembre 2016 17:13 À : [hidden email] Objet : Re: How to flatten an ImageCanvas? Hi Philippe from across Strasbourg. Maybe look at the screen grabber code : https://imagej.nih.gov/ij/source/ij/plugin/ScreenGrabber.java Jerome. On 24 November 2016 at 16:52, John Hayes <[hidden email]> wrote: > Can you post a simple example of your code then? Also, if you show > your ImagePlus in the GUI and use the “Flatten” command from the > Image->Overlay menu, does that work? Last idea: if your ImagePlus > contains a stack/hyperstack, you may have to use the ImagePlus::flattenStack command. > > John > > > On Nov 24, 2016, at 10:45 AM, CARL Philippe (PHA) < > [hidden email]> wrote: > > > > Dear John, > > I had already tried it, and it wasn't working. Unfortunately... > > My best regards, > > Philippe > > > > Le Jeudi 24 Novembre 2016 15:33 CET, John Hayes <[hidden email]> > > a > écrit: > > > >> Hi Philippe, > >> > >> I believe the easiest way is to simply call the “flatten” method of > >> the > corresponding ImagePlus instance: > >> https://imagej.nih.gov/ij/developer/api/ij/ImagePlus.html#flatten-- > >> > >> Cheers, > >> John > >> > >>> On Nov 24, 2016, at 9:25 AM, Philippe CARL > >>> <[hidden email]> > wrote: > >>> > >>> Dear all, > >>> > >>> I have an ImagePlus for which lines (= drawLine(int x1, int y1, > >>> int > x2, int > >>> y2))are drawn on its ImageCanvas. > >>> > >>> How is it possible to make a kind of flatten of these drawn lines > >>> in > order > >>> to be able to save them on top of the ImagePlus? > >>> > >>> I thank you very much in advance for your help. > >>> > >>> My best regards, > >>> > >>> Philippe > >>> > >>> > >>> > >>> Philippe CARL > >>> > >>> Laboratoire de Biophotonique et Pharmacologie > >>> > >>> UMR 7213 CNRS - Université de Strasbourg > >>> > >>> Faculté de Pharmacie > >>> > >>> 74 route du Rhin > >>> > >>> 67401 ILLKIRCH > >>> > >>> Tel : +33(0)3 68 85 41 84 > >>> > >>> > >>> -- > >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > >> > >> -- > >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > > > > > > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- Jerome Mutterer CNRS - Institut de biologie moléculaire des plantes 12, rue du Général Zimmer 67084 Strasbourg Cedex www.ibmp.cnrs.fr -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |