Login  Register

Re: remove extension image's filename

Posted by Christopher Coulon-2 on Mar 20, 2009; 4:07pm
URL: http://imagej.273.s1.nabble.com/remove-extension-image-s-filename-tp3693232p3693233.html

> It is probably so simple ! Sure, I should find in the archives but I
> searched and I found only a tricky method.
> Let's open an image and get its title (title=getTitle()). Then, do many
> things and measurements with it than finally save the results and an another
> resulting image with the same name.
>
> Example:
> The initial image I open is "toto.tif"
> I want to save final results as "toto.xls" (and not "toto.tif.xls")
> and an another resulting image as "toto_loc.tif" (and not "toto.tif_loc.tif")
>
> For that, we need to get "toto".

Eric,

You can use something like this:

            name = getTitle;
            dotIndex = indexOf(name, ".");
            title = substring(name, 0, dotIndex);

Now your name will be toto.tif and your title will be toto.  Use the title
for your saves.

Chris Coulon
       

The GAIA Group
 Global Automated Image Analysis

We help Researchers help themselves!
Find out about Online Tutoring for ImageJ

Christopher Coulon, Ph.D., Founder
http://gaiag.net
[hidden email]