Store image names without extension

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

Store image names without extension

PEARSON Matthew
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
Reply | Threaded
Open this post in threaded view
|

Re: Store image names without extension

ctrueden
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#indexOf
http://imagej.net/developer/macro/functions.html#substring

Regards,
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
Reply | Threaded
Open this post in threaded view
|

Re: Store image names without extension

Cammer, Michael

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#indexOf
http://imagej.net/developer/macro/functions.html#substring

Regards,
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
Reply | Threaded
Open this post in threaded view
|

Re: Store image names without extension

PEARSON Matthew
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#indexOf
http://imagej.net/developer/macro/functions.html#substring

Regards,
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
Reply | Threaded
Open this post in threaded view
|

Re: Store image names without extension

Glen MacDonald-2
Matt,
indexOf(string, substring) - Returns the index within string of the first occurrence of substring, such as “.”.
        helps with  .ome.tif, but not so helpful if a user puts periods in the filenames.

File.nameWithoutExtension - The name of the last file opened with the extension removed.
        bname=File.nameWithoutExtension;
        print(bname);
        Unfortunately, this function will not strip the ‘.ome’.  

Glen MacDonald
        Core for Communication Research
Virginia Merrill Bloedel Hearing Research Center
        Cellular Morphology Core
Center on Human Development and Disability
Box 357923
University of Washington
Seattle, WA 98195-7923  USA
(206) 616-4156
[hidden email]







On Oct 21, 2015, at 2:44 PM, PEARSON Matthew <[hidden email]> wrote:

> 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#indexOf
> http://imagej.net/developer/macro/functions.html#substring
>
> Regards,
> 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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Store image names without extension

PEARSON Matthew
Hi glen,

I was initially trying File.nameWithoutExtension but this doesn't work if you want to work on multiple open images which I am doing and didn't realise it wouldn't remove the ome so thanks for that tip.

I'm assuming there isn't a method to get a list of open files in an array then you could cycle through them and remove the extension using something like File.nameWithoutExtension that would work on the active image which the current method doesn't do.

I have a solution anyway.

Thanks,

Matt



-------- Original message --------
From: Glen MacDonald <[hidden email]>
Date: 22/10/2015 00:17 (GMT+00:00)
To: [hidden email]
Subject: Re: Store image names without extension

Matt,
indexOf(string, substring) - Returns the index within string of the first occurrence of substring, such as “.”.
        helps with  .ome.tif, but not so helpful if a user puts periods in the filenames.

File.nameWithoutExtension - The name of the last file opened with the extension removed.
        bname=File.nameWithoutExtension;
        print(bname);
        Unfortunately, this function will not strip the ‘.ome’.

Glen MacDonald
        Core for Communication Research
Virginia Merrill Bloedel Hearing Research Center
        Cellular Morphology Core
Center on Human Development and Disability
Box 357923
University of Washington
Seattle, WA 98195-7923  USA
(206) 616-4156
[hidden email]







On Oct 21, 2015, at 2:44 PM, PEARSON Matthew <[hidden email]> wrote:

> 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#indexOf
> http://imagej.net/developer/macro/functions.html#substring
>
> Regards,
> 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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Store image names without extension

Olivier Burri
Ask and you shall receive

imageArray = getList("image.titles");

for (i=0; i<imageArray.length; i++) {
        name = imageArray[i];
        nameNoExt = substring(name, 0, lastIndexOf(name,"."));
        print("Name Without Extension: "+nameNoExt);
}

Best

Oli

> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> PEARSON Matthew
> Sent: Thursday, October 22, 2015 8:48
> To: [hidden email]
> Subject: Re: Store image names without extension
>
> Hi glen,
>
> I was initially trying File.nameWithoutExtension but this doesn't work if you
> want to work on multiple open images which I am doing and didn't realise it
> wouldn't remove the ome so thanks for that tip.
>
> I'm assuming there isn't a method to get a list of open files in an array then
> you could cycle through them and remove the extension using something
> like File.nameWithoutExtension that would work on the active image which
> the current method doesn't do.
>
> I have a solution anyway.
>
> Thanks,
>
> Matt
>
>
>
> -------- Original message --------
> From: Glen MacDonald <[hidden email]>
> Date: 22/10/2015 00:17 (GMT+00:00)
> To: [hidden email]
> Subject: Re: Store image names without extension
>
> Matt,
> indexOf(string, substring) - Returns the index within string of the first
> occurrence of substring, such as ".".
>         helps with  .ome.tif, but not so helpful if a user puts periods in the
> filenames.
>
> File.nameWithoutExtension - The name of the last file opened with the
> extension removed.
>         bname=File.nameWithoutExtension;
>         print(bname);
>         Unfortunately, this function will not strip the '.ome'.
>
> Glen MacDonald
>         Core for Communication Research
> Virginia Merrill Bloedel Hearing Research Center
>         Cellular Morphology Core
> Center on Human Development and Disability Box 357923 University of
> Washington Seattle, WA 98195-7923  USA
> (206) 616-4156
> [hidden email]
>
>
>
>
>
>
>
> On Oct 21, 2015, at 2:44 PM, PEARSON Matthew
> <[hidden email]> wrote:
>
> > 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#indexOf
> > http://imagej.net/developer/macro/functions.html#substring
> >
> > Regards,
> > 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
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Store image names without extension

PEARSON Matthew
Ah ha thanks Oli that looks good.

cheers,

Matt





On 22 Oct 2015, at 08:37, Burri Olivier <[hidden email]>
 wrote:

> Ask and you shall receive
>
> imageArray = getList("image.titles");
>
> for (i=0; i<imageArray.length; i++) {
> name = imageArray[i];
> nameNoExt = substring(name, 0, lastIndexOf(name,"."));
> print("Name Without Extension: "+nameNoExt);
> }
>
> Best
>
> Oli
>
>> -----Original Message-----
>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>> PEARSON Matthew
>> Sent: Thursday, October 22, 2015 8:48
>> To: [hidden email]
>> Subject: Re: Store image names without extension
>>
>> Hi glen,
>>
>> I was initially trying File.nameWithoutExtension but this doesn't work if you
>> want to work on multiple open images which I am doing and didn't realise it
>> wouldn't remove the ome so thanks for that tip.
>>
>> I'm assuming there isn't a method to get a list of open files in an array then
>> you could cycle through them and remove the extension using something
>> like File.nameWithoutExtension that would work on the active image which
>> the current method doesn't do.
>>
>> I have a solution anyway.
>>
>> Thanks,
>>
>> Matt
>>
>>
>>
>> -------- Original message --------
>> From: Glen MacDonald <[hidden email]>
>> Date: 22/10/2015 00:17 (GMT+00:00)
>> To: [hidden email]
>> Subject: Re: Store image names without extension
>>
>> Matt,
>> indexOf(string, substring) - Returns the index within string of the first
>> occurrence of substring, such as ".".
>>        helps with  .ome.tif, but not so helpful if a user puts periods in the
>> filenames.
>>
>> File.nameWithoutExtension - The name of the last file opened with the
>> extension removed.
>>        bname=File.nameWithoutExtension;
>>        print(bname);
>>        Unfortunately, this function will not strip the '.ome'.
>>
>> Glen MacDonald
>>        Core for Communication Research
>> Virginia Merrill Bloedel Hearing Research Center
>>        Cellular Morphology Core
>> Center on Human Development and Disability Box 357923 University of
>> Washington Seattle, WA 98195-7923  USA
>> (206) 616-4156
>> [hidden email]
>>
>>
>>
>>
>>
>>
>>
>> On Oct 21, 2015, at 2:44 PM, PEARSON Matthew
>> <[hidden email]> wrote:
>>
>>> 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#indexOf
>>> http://imagej.net/developer/macro/functions.html#substring
>>>
>>> Regards,
>>> 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
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html


--
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