I'm having some trouble understanding how to get/set preferences. So
lets say that in IJ_Prefs.txt there's a line: dir.image=/nrims/home3/cpoczatek/biggers_movie/ So when create a new ij.Prefs object based on the API docs it sounds like it reads and parses that file, but I don't have a "dir.image" key in that Prefs object. What am I missing? Do I need to call prefs.load(Object ij, Applet a)? ij should be IJ.getInstance()? What applet? ij.Prefs prefs = new ij.Prefs(); System.out.println(prefs.get("dir.image", "")); Just prints "" because it doesn't have the key. And that is the default path you get when the user saves/opens/etc right? I mean imagej is looking at that file for the default path? And I should be able to call prefs.set("dir.image", someotherstring); Though it seems like the save button in a line profile plot defaults to the ImageJ directory. Bug? The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. |
Hi Colin,
On Tue, Mar 17, 2009 at 12:34 PM, Colin Poczatek <[hidden email]> wrote: > I'm having some trouble understanding how to get/set preferences. So > lets say that in IJ_Prefs.txt there's a line: > > dir.image=/nrims/home3/cpoczatek/biggers_movie/ > > So when create a new ij.Prefs object based on the API docs it sounds > like it reads and parses that file, but I don't have a "dir.image" key > in that Prefs object. What am I missing? Do I need to call > prefs.load(Object ij, Applet a)? ij should be IJ.getInstance()? What > applet? > > ij.Prefs prefs = new ij.Prefs(); > System.out.println(prefs.get("dir.image", "")); > > Just prints "" because it doesn't have the key. > > And that is the default path you get when the user saves/opens/etc > right? I mean imagej is looking at that file for the default path? And > I should be able to call > > prefs.set("dir.image", someotherstring); Do you use the save command in your code? Prefs.savePreferences(); Also I use the static version in my plugins, i.e., Prefs and not ij.Prefs prefs = new ij.Prefs(); Personally, I use the Preference utility from Java to save my preference and it work great. import java.util.prefs.Preferences; Hendrix |
I was looking into this not so that I can store preferences for my
plugin, but to change the default open/save directory in imagej. Since in our plugin data is getting pulled into imagej in a non-standard way the 'dir.image' value isn't getting reset when you open an image for our plugin. Then any of the native imagej open/save dialogs don't default to the same place. Does that make sense? drix wrote: > Hi Colin, > > On Tue, Mar 17, 2009 at 12:34 PM, Colin Poczatek > <[hidden email]> wrote: > >> I'm having some trouble understanding how to get/set preferences. So >> lets say that in IJ_Prefs.txt there's a line: >> >> dir.image=/nrims/home3/cpoczatek/biggers_movie/ >> >> So when create a new ij.Prefs object based on the API docs it sounds >> like it reads and parses that file, but I don't have a "dir.image" key >> in that Prefs object. What am I missing? Do I need to call >> prefs.load(Object ij, Applet a)? ij should be IJ.getInstance()? What >> applet? >> >> ij.Prefs prefs = new ij.Prefs(); >> System.out.println(prefs.get("dir.image", "")); >> >> Just prints "" because it doesn't have the key. >> >> And that is the default path you get when the user saves/opens/etc >> right? I mean imagej is looking at that file for the default path? And >> I should be able to call >> >> prefs.set("dir.image", someotherstring); >> > > Do you use the save command in your code? > Prefs.savePreferences(); > Also I use the static version in my plugins, i.e., Prefs and not > ij.Prefs prefs = new ij.Prefs(); > > Personally, I use the Preference utility from Java to save my > preference and it work great. > import java.util.prefs.Preferences; > > Hendrix > The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. |
Hi Colin,
what about OpenDialog.setDefaultDirectory(myDir); ? Michael ________________________________________________________________ On 17 Mar 2009, at 19:23, Colin Poczatek wrote: > I was looking into this not so that I can store preferences for my > plugin, but to change the default open/save directory in imagej. > > Since in our plugin data is getting pulled into imagej in a non- > standard > way the 'dir.image' value isn't getting reset when you open an > image for > our plugin. Then any of the native imagej open/save dialogs don't > default to the same place. > > Does that make sense? > > > > drix wrote: >> Hi Colin, >> >> On Tue, Mar 17, 2009 at 12:34 PM, Colin Poczatek >> <[hidden email]> wrote: >> >>> I'm having some trouble understanding how to get/set >>> preferences. So >>> lets say that in IJ_Prefs.txt there's a line: >>> >>> dir.image=/nrims/home3/cpoczatek/biggers_movie/ >>> >>> So when create a new ij.Prefs object based on the API docs it sounds >>> like it reads and parses that file, but I don't have a >>> "dir.image" key >>> in that Prefs object. What am I missing? Do I need to call >>> prefs.load(Object ij, Applet a)? ij should be IJ.getInstance()? >>> What >>> applet? >>> >>> ij.Prefs prefs = new ij.Prefs(); >>> System.out.println(prefs.get("dir.image", "")); >>> >>> Just prints "" because it doesn't have the key. >>> >>> And that is the default path you get when the user saves/opens/etc >>> right? I mean imagej is looking at that file for the default >>> path? And >>> I should be able to call >>> >>> prefs.set("dir.image", someotherstring); >>> >> >> Do you use the save command in your code? >> Prefs.savePreferences(); >> Also I use the static version in my plugins, i.e., Prefs and not >> ij.Prefs prefs = new ij.Prefs(); >> >> Personally, I use the Preference utility from Java to save my >> preference and it work great. >> import java.util.prefs.Preferences; >> >> Hendrix >> > > > > The information in this e-mail is intended only for the person to > whom it is > addressed. If you believe this e-mail was sent to you in error and > the e-mail > contains patient information, please contact the Partners > Compliance HelpLine at > http://www.partners.org/complianceline . If the e-mail was sent to > you in error > but does not contain patient information, please contact the sender > and properly > dispose of the e-mail. |
Free forum by Nabble | Edit this page |