use the getDirectory command for DM3 images

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

use the getDirectory command for DM3 images

Caroline Petitjean
Hello all,

I have a very simple problem: I want to write a macro to open dm3
images, convert them all to 8-bit tiff images and save them in the same
folder again. But the command

getDirectory("image")

does not work on dm3 images (only on tiff, jpeg and so on). Can somebody
tell me why and/or give me a solution around this problem?

Thanks a lot
Caro
Reply | Threaded
Open this post in threaded view
|

Re: use the getDirectory command for DM3 images

Michael Schmid
Hi Caro,

getDirectory("image") returns the path to the directory that
the active (foreground) image was loaded from.

As far as I see, the dm3 loader plugin on the ImageJ web site
uses the FileOpener, which calls imp.setFileInfo(fi), storing
the directory information of a file in the ImagePlus.
Thus, getDirectory("image") should work on dm3 images.

I don't have dm3 files to test, but you should see the
directory and filename with "Image>Show info..."
If it is not there, maybe the image was not the result of opening
a dm3 file from disk but e.g. created by "Duplicate"?


Michael
________________________________________________________________

On 20 Aug 2008, at 14:12, Caroline Petitjean wrote:

> Hello all,
>
> I have a very simple problem: I want to write a macro to open dm3  
> images, convert them all to 8-bit tiff images and save them in the  
> same folder again. But the command
>
> getDirectory("image")
>
> does not work on dm3 images (only on tiff, jpeg and so on). Can  
> somebody tell me why and/or give me a solution around this problem?
>
> Thanks a lot
> Caro
Reply | Threaded
Open this post in threaded view
|

Re: use the getDirectory command for DM3 images

Ben Tupper
On Aug 20, 2008, at 2:16 PM, Michael Schmid wrote:

> Hi Caro,
>
> getDirectory("image") returns the path to the directory that
> the active (foreground) image was loaded from.
>
> As far as I see, the dm3 loader plugin on the ImageJ web site
> uses the FileOpener, which calls imp.setFileInfo(fi), storing
> the directory information of a file in the ImagePlus.
> Thus, getDirectory("image") should work on dm3 images.
>
> I don't have dm3 files to test, but you should see the
> directory and filename with "Image>Show info..."
> If it is not there, maybe the image was not the result of opening
> a dm3 file from disk but e.g. created by "Duplicate"?
>
>

Hi,

I can't speak to the image format issues, but perhaps you are looking  
to get a list of the files contained in the specified directory?  If  
so then take a look at...

  http://rsb.info.nih.gov/ij/macros/ListFilesRecursively.txt

or use the macro command getFileList(directory) ...

http://rsb.info.nih.gov/ij/developer/macro/functions.html#F

Cheers,
ben


> Michael
> ________________________________________________________________
>
> On 20 Aug 2008, at 14:12, Caroline Petitjean wrote:
>
>> Hello all,
>>
>> I have a very simple problem: I want to write a macro to open dm3  
>> images, convert them all to 8-bit tiff images and save them in the  
>> same folder again. But the command
>>
>> getDirectory("image")
>>
>> does not work on dm3 images (only on tiff, jpeg and so on). Can  
>> somebody tell me why and/or give me a solution around this problem?
>>
>> Thanks a lot
>> Caro

Ben Tupper
[hidden email]

I GoodSearch for Ashwood Waldorf School.

Raise money for your favorite charity or school just by searching the  
Internet with GoodSearch - www.goodsearch.com - powered by Yahoo!