getting the path of an image

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

getting the path of an image

Mohamed Tleis
Dear Folks,

I am using opener class (ij.io.opener) to open an image which is later
assigned to an ImagePlus. after processing the image I want to save it. I
have an ImagePlus, but I am not able to get the path of the image or at
least it's name.
I am sure it is a simple process, but I am not able to find any function in
opener class that might help me.

Thanks in advance
Mohamed Tleis
Reply | Threaded
Open this post in threaded view
|

Re: getting the path of an image

Albert Cardona-2
Use ImagePlus.getOriginalFileInfo to get the directory and fileName, then use a new FileSaver.

http://albert.rierol.net

On Dec 11, 2011, at 10:59 AM, Mohammed Tlais <[hidden email]> wrote:

> Dear Folks,
>
> I am using opener class (ij.io.opener) to open an image which is later
> assigned to an ImagePlus. after processing the image I want to save it. I
> have an ImagePlus, but I am not able to get the path of the image or at
> least it's name.
> I am sure it is a simple process, but I am not able to find any function in
> opener class that might help me.
>
> Thanks in advance
> Mohamed Tleis
Reply | Threaded
Open this post in threaded view
|

Re: getting the path of an image

BenTupper
In reply to this post by Mohamed Tleis
Hi,

On Dec 11, 2011, at 10:59 AM, Mohammed Tlais wrote:

> Dear Folks,
>
> I am using opener class (ij.io.opener) to open an image which is later
> assigned to an ImagePlus. after processing the image I want to save it. I
> have an ImagePlus, but I am not able to get the path of the image or at
> least it's name.

The ij.io.opener class has getDir() and getName() methods.  You could retrieve these before loosing the reference to opener, and store them as properties of your plugin class.  

Cheers,
Ben




> I am sure it is a simple process, but I am not able to find any function in
> opener class that might help me.
>
> Thanks in advance
> Mohamed Tleis
Reply | Threaded
Open this post in threaded view
|

Re: getting the path of an image

BenTupper
Hi Mohammed,

I gave you bad advice on this and for that I am sorry.  Opener's getDir() and getName() methods do not provide you with access to the file's directory and name.  Albert Cardona has given you advice on how to use the getOriginalFileInfo() method for ImagePlus.  

> On Dec 11, 2011, at 12:24 PM, Albert Cardona wrote:
>
>> Use ImagePlus.getOriginalFileInfo to get the directory and fileName, then use a new FileSaver.


I hope you haven't spent a lot of time spinning on my mess-up.

Cheers,
Ben



On Dec 12, 2011, at 5:53 AM, Mohammed Tlais wrote:

>
> Thank you Ben,
>
> I was trying to look into the documentation of the opener class, and couldn't find any helpful information on how to solve my problem.
>
> I am using the Opener.open() method to open an image.
> the getDir and getName , takes a string argument which is the path of the image. i was wondering how can I know this path?
>
> Best Regards,
> Mohamed Tleis
>
> On Sun, Dec 11, 2011 at 6:35 PM, Ben Tupper <[hidden email]> wrote:
> Hi,
>
> On Dec 11, 2011, at 10:59 AM, Mohammed Tlais wrote:
>
> > Dear Folks,
> >
> > I am using opener class (ij.io.opener) to open an image which is later
> > assigned to an ImagePlus. after processing the image I want to save it. I
> > have an ImagePlus, but I am not able to get the path of the image or at
> > least it's name.
>
> The ij.io.opener class has getDir() and getName() methods.  You could retrieve these before loosing the reference to opener, and store them as properties of your plugin class.
>
> Cheers,
> Ben
>
>
>
>
> > I am sure it is a simple process, but I am not able to find any function in
> > opener class that might help me.
> >
> > Thanks in advance
> > Mohamed Tleis
>