All,
Is there a way to make a URL in an ImageJ error or message dialog 'hyper', i.e., so the user can just click on the text to go to a website? A quick google of the web and search of the IJ source was not fruitful. Michael |
Hi,
On Tue, 8 Jun 2010, Michael Doube wrote: > Is there a way to make a URL in an ImageJ error or message dialog > 'hyper', i.e., so the user can just click on the text to go to a > website? IJ.showMessage() does accept HTML as a message, but it uses JLabel to handle that code, and JLabel does not foresee any method to react to the user clicking a link. So you need to implement it yourself using a JEditorPane that has editing disabled. Luckily, this is not too difficult: -- snipsnap -- import ij.plugin.BrowserLauncher; import ij.plugin.PlugIn; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.JButton; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; public class HTML_Message implements PlugIn { public void run(String arg) { JEditorPane htmlPane = new JEditorPane("text/html", "<html>\n" + " <body>\n" + " <a href=http://pacific.mpi-cbg.de/>\n" + " Fiji is super!\n" + " </a>\n" + " </body>\n" + "</html>"); htmlPane.setEditable(false); htmlPane.setOpaque(false); htmlPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) try { BrowserLauncher.openURL(e.getURL().toString()); } catch (IOException exception) { // ignore } } }); JPanel panel = new JPanel(new BorderLayout()); panel.add(htmlPane, BorderLayout.CENTER); JButton okay = new JButton("OK"); panel.add(okay, BorderLayout.SOUTH); final JFrame frame = new JFrame("HyperlinkListener"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(panel, BorderLayout.CENTER); frame.pack(); okay.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { frame.dispose(); } }); frame.setVisible(true); } } |
In reply to this post by Michael Doube
On Jun 8, 2010, at 9:44 AM, Michael Doube wrote:
> All, > > Is there a way to make a URL in an ImageJ error or message dialog > 'hyper', i.e., so the user can just click on the text to go to a website? > > A quick google of the web and search of the IJ source was not fruitful. You can add a "Help" button that opens a URL to GenericDialogs. With v1.44c and later, you can specify the font used to display the error message and the label used by the "Help" button. Here is an example: void error(String title, String message) { GenericDialog gd = new GenericDialog(title); Font font = new Font("SansSerif", Font.PLAIN, 16); gd.addMessage(message, font); // requires 1.44c gd.addHelp("http://rsb.info.nih.gov/ij/"); gd.setHelpLabel("More Information"); // requires 1.44c gd.hideCancelButton(); gd.showDialog(); } -wayne |
Wayne,
Is there a file.copy() macro command (or something similar)? I need to copy a *.txt output file to a *.csv file so that it can be easily opened by Excel or MiniTab. I need to retain both the txt and csv files. Thanks in advance (again). Rick -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Rasband, Wayne (NIH/NIMH) [E] Sent: Tuesday, June 08, 2010 1:36 PM To: [hidden email] Subject: Re: Hypertext links in IJ.showMessage On Jun 8, 2010, at 9:44 AM, Michael Doube wrote: > All, > > Is there a way to make a URL in an ImageJ error or message dialog > 'hyper', i.e., so the user can just click on the text to go to a website? > > A quick google of the web and search of the IJ source was not fruitful. You can add a "Help" button that opens a URL to GenericDialogs. With v1.44c and later, you can specify the font used to display the error message and the label used by the "Help" button. Here is an example: void error(String title, String message) { GenericDialog gd = new GenericDialog(title); Font font = new Font("SansSerif", Font.PLAIN, 16); gd.addMessage(message, font); // requires 1.44c gd.addHelp("http://rsb.info.nih.gov/ij/"); gd.setHelpLabel("More Information"); // requires 1.44c gd.hideCancelButton(); gd.showDialog(); } -wayne --------------------------------------------------------------------------------------------------------- This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. --------------------------------------------------------------------------------------------------------- |
In reply to this post by Rasband, Wayne (NIH/NIMH) [E]
Dear list members,
Is there a possibility to make the roiManager("Measure) macro command sensitive to a threshold setting, such that it only measures inside a defined intensity range? Checking 'limit to threshold' in the 'set measurements' tab only seems to work for the 'Analyze Particles' command. Many thanks in advance. Regards, Winnok ___________________________ Winnok H. De Vos, PhD Bio-imaging and Cytometry Unit Dept. Molecular Biotechnology University of Ghent Coupure Links 653 9000 Ghent, Belgium Tel +32 (0)9 264.59.71 Fax +32 (0)9 264.62.19 |
Hi,
On Tue, 8 Jun 2010, Winnok H. De Vos wrote: > Is there a possibility to make the roiManager("Measure) macro command > sensitive to a threshold setting, such that it only measures inside a > defined intensity range? Checking 'limit to threshold' in the 'set > measurements' tab only seems to work for the 'Analyze Particles' > command. The only way to do that with a macro which I can imagine is to create masks, combine them with AND, and create a selection after choosing the threshold 128. Alternatively, you could use Javascript to call the and() method of ShapeRoi: http://pacific.mpi-cbg.de/javadoc/ij/gui/ShapeRoi.html#and(ij.gui.ShapeRoi) Ciao, Dscho |
In reply to this post by Rasband, Wayne (NIH/NIMH) [E]
On 08/06/10 20:35, Rasband, Wayne (NIH/NIMH) [E] wrote:
> On Jun 8, 2010, at 9:44 AM, Michael Doube wrote: > >> All, >> >> Is there a way to make a URL in an ImageJ error or message dialog >> 'hyper', i.e., so the user can just click on the text to go to a website? >> >> A quick google of the web and search of the IJ source was not fruitful. > > You can add a "Help" button that opens a URL to GenericDialogs. With v1.44c and later, you can specify the font used to display the error message and the label used by the "Help" button. Here is an example: > > void error(String title, String message) { > GenericDialog gd = new GenericDialog(title); > Font font = new Font("SansSerif", Font.PLAIN, 16); > gd.addMessage(message, font); // requires 1.44c > gd.addHelp("http://rsb.info.nih.gov/ij/"); > gd.setHelpLabel("More Information"); // requires 1.44c > gd.hideCancelButton(); > gd.showDialog(); > } > > -wayne Wayne, This is excellent, thanks. Michael |
In reply to this post by Rick Simmons
Hi Rick,
for text files you can use string = File.openAsString(path); File.saveString(string, path); Note that this may change the line termination character (it is converted to linfeed, "\n" on read). Michael ________________________________________________________________ On 8 Jun 2010, at 22:36, SIMMONS, RICK L [AG/1850] wrote: > Wayne, > Is there a file.copy() macro command (or something similar)? I > need to > copy a *.txt output file to a *.csv file so that it can be easily > opened > by Excel or MiniTab. I need to retain both the txt and csv files. > Thanks in advance (again). > > Rick |
In reply to this post by Rick Simmons
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Hello, you can use exec to do it with a native command. This will be system dependent. On linux: exec("cp", "/home/baecker/tmp/test.txt", "/home/baecker/tmp/test.csv") on windows: exec("cmd /c copy \"C:\\Documents and Settings\\baecker\\test.txt\" \"C:\\Documents and Settings\\baecker\\test.csv\""); Volker On 08/06/10 22:36, SIMMONS, RICK L [AG/1850] wrote: > Wayne, > Is there a file.copy() macro command (or something similar)? I need to > copy a *.txt output file to a *.csv file so that it can be easily opened > by Excel or MiniTab. I need to retain both the txt and csv files. > Thanks in advance (again). > > Rick > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of > Rasband, Wayne (NIH/NIMH) [E] > Sent: Tuesday, June 08, 2010 1:36 PM > To: [hidden email] > Subject: Re: Hypertext links in IJ.showMessage > > On Jun 8, 2010, at 9:44 AM, Michael Doube wrote: > >> All, >> >> Is there a way to make a URL in an ImageJ error or message dialog >> 'hyper', i.e., so the user can just click on the text to go to a > website? >> >> A quick google of the web and search of the IJ source was not > fruitful. > > You can add a "Help" button that opens a URL to GenericDialogs. With > v1.44c and later, you can specify the font used to display the error > message and the label used by the "Help" button. Here is an example: > > void error(String title, String message) { > GenericDialog gd = new GenericDialog(title); > Font font = new Font("SansSerif", Font.PLAIN, 16); > gd.addMessage(message, font); // requires 1.44c > gd.addHelp("http://rsb.info.nih.gov/ij/"); > gd.setHelpLabel("More Information"); // requires 1.44c > gd.hideCancelButton(); > gd.showDialog(); > } > > -wayne > > > --------------------------------------------------------------------------------------------------------- > This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. > > > All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. > --------------------------------------------------------------------------------------------------------- > Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwPUH8ACgkQ0gXPLVKexCcHigCfSZSrPLP8KcUKC4DGjojt57XB OVgAniwLEDz7J4VEzCAKPPf5ik8qMFyd =w925 -----END PGP SIGNATURE----- -- passerelle antivirus du campus CNRS de Montpellier -- |
In reply to this post by Winnok H. De Vos
Hi Dr. De Vos
maybe something like this ..."snip" //next we get the tubules into the ROI manager. The image needs to be drawn to remember the outlines later selectWindow("Lumens" +title); setThreshold(250, 255); run("Make Binary", "thresholded remaining black"); run("Analyze Particles...", "size=500-Infinity circularity=0.00-1.00 show=Nothing display clear add"); run("Clear Results"); //here we select a tubule outline then apply it to the DAB mask one at a time. n = roiManager("count"); for (z=0; z<n; z++) { roiManager("select", z); run("Copy"); //each ROI is copied, and applied to the other image, which is a mask. selectImage("DAB" +title); run("Restore Selection"); run("Analyze Particles...", "minimum=1 maximum=999999 bins=256 show=Nothing display clear"); cells=(nResults); print(cells); selectImage("Lumens" +title); } -- Paul C. Grimm Professor of Pediatrics Dept of Pediatric Nephrology Lucile Packard Children's Hospital Stanford University School of Medicine G306, MC 5208 300 Pasteur Drive Stanford, CA 94305-5208 USA phone 650-723-7903 fax 650-498-6714 "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world". Albert Einstein On Jun 8, 2010, at 2:36 PM, Winnok H. De Vos wrote: > Dear list members, > > Is there a possibility to make the roiManager("Measure) macro command sensitive to a threshold setting, such that it only measures inside a defined intensity range? > Checking 'limit to threshold' in the 'set measurements' tab only seems to work for the 'Analyze Particles' command. > Many thanks in advance. > Regards, > > Winnok > > ___________________________ > > Winnok H. De Vos, PhD > > Bio-imaging and Cytometry Unit > Dept. Molecular Biotechnology > University of Ghent > Coupure Links 653 > 9000 Ghent, Belgium > > Tel +32 (0)9 264.59.71 > Fax +32 (0)9 264.62.19 |
Dear Paul
Thanks for your reply. In fact the roiManager("measure") command works with a threshold setting, but what I forgot to mention is that I wanted to redirect the measurements on another image when specifying a threshold setting on the mask image (because this mask image contains a location coding). roiManager("measure") works with limit to threshold on the original image and even works when measuring a mask with a threshold set on the original image, but not when a threshold is set to the mask. In hindsight, this is quite logical, the 'redirect' option transfers all the characteristics of the measure command to the redirected image. Otherwise the measure command would have to decide which image's threshold setting to take into account before measuring. I have therefore diverted to a an alternative strategy. Kind regards, Winnok ___________________________ Winnok H. De Vos, PhD Bio-imaging and Cytometry Unit Dept. Molecular Biotechnology University of Ghent Coupure Links 653 9000 Ghent, Belgium Tel +32 (0)9 264.59.71 Fax +32 (0)9 264.62.19 On 26 Jun 2010, at 06:57, Paul Grimm wrote: Hi Dr. De Vos maybe something like this ..."snip" //next we get the tubules into the ROI manager. The image needs to be drawn to remember the outlines later selectWindow("Lumens" +title); setThreshold(250, 255); run("Make Binary", "thresholded remaining black"); run("Analyze Particles...", "size=500-Infinity circularity=0.00-1.00 show=Nothing display clear add"); run("Clear Results"); //here we select a tubule outline then apply it to the DAB mask one at a time. n = roiManager("count"); for (z=0; z<n; z++) { roiManager("select", z); run("Copy"); //each ROI is copied, and applied to the other image, which is a mask. selectImage("DAB" +title); run("Restore Selection"); run("Analyze Particles...", "minimum=1 maximum=999999 bins=256 show=Nothing display clear"); cells=(nResults); print(cells); selectImage("Lumens" +title); } -- Paul C. Grimm Professor of Pediatrics Dept of Pediatric Nephrology Lucile Packard Children's Hospital Stanford University School of Medicine G306, MC 5208 300 Pasteur Drive Stanford, CA 94305-5208 USA phone 650-723-7903 fax 650-498-6714 "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world". Albert Einstein On Jun 8, 2010, at 2:36 PM, Winnok H. De Vos wrote: > Dear list members, > > Is there a possibility to make the roiManager("Measure) macro command sensitive to a threshold setting, such that it only measures inside a defined intensity range? > Checking 'limit to threshold' in the 'set measurements' tab only seems to work for the 'Analyze Particles' command. > Many thanks in advance. > Regards, > > Winnok > > ___________________________ > > Winnok H. De Vos, PhD > > Bio-imaging and Cytometry Unit > Dept. Molecular Biotechnology > University of Ghent > Coupure Links 653 > 9000 Ghent, Belgium > > Tel +32 (0)9 264.59.71 > Fax +32 (0)9 264.62.19 |
Free forum by Nabble | Edit this page |