Re: How to retrieve current RAW import parameters non-interactively?
Posted by
Wayne Rasband on
Feb 27, 2008; 9:02pm
URL: http://imagej.273.s1.nabble.com/How-to-retrieve-current-RAW-import-parameters-non-interactively-tp3697071p3697072.html
Use the ImportDialog.getLastFileInfo() method, which was added in
ImageJ 1.39t, to retrieve the settings used by the File>Import>Raw
command. You can upgrade to v1.39t by using the ImageJ_Updater plugin
(
http://rsb.info.nih.gov/ij/plugins/imagej-updater.html) and selecting
"daily build" from the drop down menu. The release notes for the daily
build are at <
http://rsbweb.nih.gov/ij/source/release-notes.html>.
-wayne
On Feb 27, 2008, at 2:05 PM, Josh D wrote:
> Hello,
> I deal with many RAW images, each of varying dimensions and varying
> header sizes. Doing File->Import->Raw each time I wish to open a new
> image gets very tedious.
>
> What I would like to do is add a section of code to the
> HandleExtraFileTypes.java plugin. After the image fails to match any
> supported formats, my bit of code would then non-interactively attempt
> to open the file using the last used RAW import parameters. What I
> have now is as follows:
>
> //Try to open as RAW image
> ImportDialog impdlg = new ImportDialog(name,directory);
> FileInfo fi = impdlg.getFileInfo();
> if (fi!=null) {
> FileOpener fo = new FileOpener(fi);
> imp = (ImagePlus)fo.open(false);
> if (imp!=null)
> return imp;
> }
>
> This allows me to drag and drop RAW images or use File->Import->Image
> Sequence, HOWEVER I have to accept the dialog settings for every
> single image.
>
>
> Is there a way to retrieve the settings used with the import RAW
> dialog box without actually displaying the dialog? Right now all the
> required variables or private members. I know I can retrieve the
> parameters from the prefs file, but that only contains the settings
> used from a previous session of ImageJ. I would like to be able to
> open one image successfully in ImageJ and then use those same settings
> from then on.
>
> Thanks for any suggestions!
> -Josh
>