Posted by
PEARSON Matthew on
Oct 21, 2015; 9:44pm
URL: http://imagej.273.s1.nabble.com/Store-image-names-without-extension-tp5014703p5014712.html
Hi Curtis and Micheal,
Thanks for your suggestions I will give them a try!
Cheers,
Matt
-------- Original message --------
From: "Cammer, Michael" <
[hidden email]>
Date: 21/10/2015 21:03 (GMT+00:00)
To:
[hidden email]
Subject: Re: Store image names without extension
Here's a function I often paste at the end of whatever macro file I'm writing.
/====================================
// Use this function to strip any number of extensions
// off images.
// Returns the title without the extension.
//====================================
function getTitleStripExtension() {
t = getTitle();
t = replace(t, ".tif", "");
t = replace(t, ".tiff", "");
t = replace(t, ".lif", "");
t = replace(t, ".lsm", "");
t = replace(t, ".czi", "");
t = replace(t, ".nd2", "");
return t;
}
=========================================================================
Michael Cammer, Microscopy Core & Skirball Institute, NYU Langone Medical Center
Cell: 914-309-3270 ** Office: Skirball 2nd Floor main office, back right **
http://ocs.med.nyu.edu/microscopy &
http://microscopynotes.com/-----Original Message-----
From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of Curtis Rueden
Sent: Wednesday, October 21, 2015 2:47 PM
To:
[hidden email]
Subject: Re: Store image names without extension
Hi Matt,
> I was wondering what the easiest way in the macro language is to store
> the name of an image minus its extension in a variable.
s = "Hello, world!.ome.tiff";
dot = indexOf(s, ".");
if (dot >= 0) s = substring(s, 0, dot);
showMessage(s);
http://imagej.net/developer/macro/functions.html#indexOfhttp://imagej.net/developer/macro/functions.html#substringRegards,
Curtis
On Wed, Oct 21, 2015 at 12:33 PM, PEARSON Matthew <
[hidden email]> wrote:
> Hi all,
>
> I was wondering what the easiest way in the macro language is to store
> the name of an image minus its extension in a variable. I'm working
> with ome tiff's so the extension is ".ome.tif" and i'd like to remove this.
>
> Thanks for the help,
>
> Matt
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html------------------------------------------------------------
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email.
=================================
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html