Getting file info from ImagePlus objects

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

Getting file info from ImagePlus objects

simon andrews (BI)
In a plugin I'm writing I'm trying to extract the full path to the  
original image which is being processed.  The images are TIFF stacks.

I've tried a few different methods, the most promising of which seemed  
to be getFileInfo - but when I call this the object which is returned  
has no value in its directory field, and a file name of Untitled.

The only place I've found any file information was in the getTitle()  
method of ImagePlus which gets me the window title (which happens to  
be the file name), but this doesn't get me the directory the image  
came from and the pwd doesn't match this either.

How can I get this information?

Thanks

Simon.
Reply | Threaded
Open this post in threaded view
|

Antwort: Getting file info from ImagePlus objects

Joachim Wesner
Hi Simon,

what about getOriginalFileInfo? Thsi should work!?

There is some entry in the archive that any problem with stacks was fixed
already in version 1.37c

(Thanx for asking this, up till now, I was not aware of these methods!)


Mit freundlichen Grüßen / Best regards

Joachim Wesner




                                                                           
             Simon Andrews                                                
             <simon.andrews@BB                                            
             SRC.AC.UK>                                                 An
             Gesendet von:              [hidden email]                
             ImageJ Interest                                         Kopie
             Group                                                        
             <[hidden email].                                       Thema
             GOV>                       Getting file info from ImagePlus  
                                        objects                            
                                                                           
             12.08.2009 12:44                                              
                                                                           
                                                                           
              Bitte antworten                                              
                    an                                                    
              ImageJ Interest                                              
                   Group                                                  
             <[hidden email].                                            
                   GOV>                                                    
                                                                           
                                                                           




In a plugin I'm writing I'm trying to extract the full path to the
original image which is being processed.  The images are TIFF stacks.

I've tried a few different methods, the most promising of which seemed
to be getFileInfo - but when I call this the object which is returned
has no value in its directory field, and a file name of Untitled.

The only place I've found any file information was in the getTitle()
method of ImagePlus which gets me the window title (which happens to
be the file name), but this doesn't get me the directory the image
came from and the pwd doesn't match this either.

How can I get this information?

Thanks

Simon.



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Antwort: Getting file info from ImagePlus objects

simon andrews (BI)
On 12 Aug 2009, at 12:06, Joachim Wesner wrote:

> Hi Simon,
>
> what about getOriginalFileInfo? Thsi should work!?

Excellent - that did the trick.  Don't know how I missed that when  
going through the API

Thanks!

Simon.
Reply | Threaded
Open this post in threaded view
|

Re: Getting file info from ImagePlus objects

danibodor
In reply to this post by simon andrews (BI)

getDirectory("image") - Returns the path to the directory that the active image was loaded from. (quote from ImageJ site).
Then using getTitle function gets the actual title of your image.

Thus you can write:

path = getDirectory("image")+getTitle();



simon andrews (BI) wrote
In a plugin I'm writing I'm trying to extract the full path to the  
original image which is being processed.  The images are TIFF stacks.

I've tried a few different methods, the most promising of which seemed  
to be getFileInfo - but when I call this the object which is returned  
has no value in its directory field, and a file name of Untitled.

The only place I've found any file information was in the getTitle()  
method of ImagePlus which gets me the window title (which happens to  
be the file name), but this doesn't get me the directory the image  
came from and the pwd doesn't match this either.

How can I get this information?

Thanks

Simon.