Login  Register

Re: Opening non-supported files with a macro

Posted by Michael Schmid on Jul 10, 2007; 2:31pm
URL: http://imagej.273.s1.nabble.com/Opening-non-supported-files-with-a-macro-tp3698906p3698913.html

Hi Gabriel,

what about something like this:

   headerLength = 1024; //how many bytes to read initially to analyze  
the header
   run("Raw...", "image=8-bit height=1 offset=0 number=1 width="+
     headerLength); //asks the user for the file and reads the header
   path = "'"+getDirectory("image")+getTitle+"'";

   (... analyze header by reading the image as a byte array ...)

   run("Raw...", "open="+path+" image='32-bit Real' width="+width+
     " height="+height+" offset="+headerLength); //now really open  
the image


Michael
________________________________________________________________

On 10 Jul 2007, at 14:41, Gabriel Landini wrote:

> Hi,
> I am writing a macro to load images from a thermal imaging system.
> I can import the data with the File>Import command but I want to  
> have a macro
> that will let me choose which file to open.
>
> If I use the open() macro function, it expects to open a file in a  
> supported
> format, but of course I only want to get the file name through the  
> file
> chooser.
>
> Is there a way to do this (get a non-supported file name using a  
> file chooser)
> with a macro (instead of a plugin)?
>
> Thanks
>
> Gabriel