Thank you for your suggestion. Now I can generate my own open dialog without the confusion of having inaccurate width and height values.
From: Rasband, Wayne (NIH/NIMH) [E] [via ImageJ] [mailto:ml-node+[hidden email]]
Sent: Saturday, May 07, 2016 10:13 PM
To: Honig, John
Subject: Re: IJ.run command options defaults in plugin
> On May 6, 2016, at 5:42 PM, jhonig2 <[hidden email]> wrote:
>
> Hello,
>
> I have written a plug-in (based on the Raw_File_Opener plug-in) that allows
> the user to open a *.raw file.
> In my case, I am trying to pre-populate the options image=unsigned 16-bit,
> width=1624, height=1234.
>
> In the plug-in, I have the statement
>
> IJ.run("Raw...", "open=[" + directory + fi.fileName + "] image=[16-bit
> Unsigned] width=1624 height=1234");
>
> When I run the plug-in, Import>Raw dialog box opens and the image type,
> width and height values are populated with whatever values had been entered
> manually, previously.
>
> However....when I click ok, my values are accepted (16-bit unsigned,
> width=1624, height=1234) and the plug-in works fine. Yet, when I run the
> plug-in again, those original, manually entered values appear in the
> Import>Raw dialog box.
>
> I would just like the Import>Raw dialog box to display the values that I
> think it should.
I do not know of a way to set the values displayed in the Import>Raw dialog but it’s not needed if the values are known. Here is a JavaScript example that opens a 1624x1234,16-bit unsigned raw file:
width = 1624;
height = 1234;
od = new OpenDialog("Choose a Raw File", "");
fi = new FileInfo();
fi.directory = od.getDirectory();
fi.fileName = od.getFileName();
fi.fileFormat = fi.RAW;
fi.fileType = FileInfo.GRAY16_UNSIGNED;
fi.width = width;
fi.height = height;
fo = new FileOpener(fi);
img = fo.open(false);
if (img!=null)
img.show();
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/IJ-run-command-options-defaults-in-plugin-tp5016348p5016354.html
To unsubscribe from IJ.run command options defaults in plugin,
click here.
NAML
Free forum by Nabble | Disable Popup Ads | Edit this page |