Login  Register

Re: Presets and recent settings in import raw dialog

Posted by Michael Schmid on Sep 05, 2013; 4:39pm
URL: http://imagej.273.s1.nabble.com/Presets-and-recent-settings-in-import-raw-dialog-tp5004671p5004680.html

Hi Josh,

how do you determine the correct settings for the import dialog, when you do it by hand?
Is there really no way to automate what you are doing manually?

As I said, the macro could determine the file size, and/or analyze the file name. It might even read the beginning of a file if some information can be retrieved from a header (binary or text). Or it might read a special file from the image directory containing a description of the image files...

Eventually, your HandleExtraFileTypes could forward the raw files to a macro or plugin that does all this work...

----

One more possibility:

The defaults of the ImportDialog are saved in the prefs. See
  http://imagej.nih.gov/ij/source/ij/io/ImportDialog.java

You can use the macro language to read/write the prefs, e.g.

  type = call("ij.Prefs.get", "raw.type","8-bit");
  width = parseInt(call("ij.Prefs.get", "raw.width","512"));

and

  call("ij.Prefs.set", "raw.type", type);
  call("ij.Prefs.set", "raw.width", toString(width));

Thus, you could build your own set of macros, one for each file type.
Alternatively, have one macro that asks the user which of many possible sets of parameters should be used to initialize the 'import raw' dialog.

Michael
________________________________________________________________

On Sep 5, 2013, at 18:04, Josh Doe wrote:

> On Thu, Sep 5, 2013 at 11:42 AM, José María Mateos <[hidden email]>wrote:
>
>> 2013/9/5 Josh Doe <[hidden email]>:
>>> Not sure if I'm the only one that encounters this, but often I'm faced
>> with
>>> opening many raw (headerless) files, with several different settings
>>> (width, height, gap, offset, etc.). To go back and forth between
>> different
>>> image sets requires changing these each time.
>>>
>>> What about creating a combobox with presets and/or recently used
>> settings?
>>> I figure this would entail adding a single combobox, and two buttons
>> (Save,
>>> Remove).
>>
>> This could be easily accomplished by using a macro, right?
>>
>
> That would be one way to do it, but it would require manually changing the
> macro to point to the file I want to open, and new macros would have to be
> created for every combination of settings. My use case is using
> File->Import->Raw or drag-and-dropping to open many files with many
> different settings (I have HandleExtraFileTypes assume a file is raw if it
> fails every other test), which would make the macro approach ineffective.
>
> Seeing a similar suggestion from Michael, his idea of having a macro ask
> for the filename is an improvement, however it still requires managing
> macros, adding them to shortcuts/toolbars/etc. I see dozens of different
> settings, including new ones quite frequently, so managing these macros and
> easily going back and forth doesn't seem enjoyable.
>
> -Josh
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html