Posted by
ctrueden on
May 25, 2016; 6:47pm
URL: http://imagej.273.s1.nabble.com/Name-of-duplicated-slice-from-a-stack-tp5016521p5016527.html
Hi Bill,
> If a window name might have multiple "." characters in it (I've
> prevented this possibility elsewhere in my code), then a test for
> this is needed.
Instead of using "indexOf" you can use "lastIndexOf" which is a more robust
way to get the file extension. The only issue then is for file extensions
which themselves use a dot, e.g. ".ome.tif", but in most cases you do not
need to worry about these.
See also the "File.nameWithoutExtension" macro function.
Regards,
Curtis
--
Curtis Rueden
LOCI software architect -
http://loci.wisc.edu/softwareImageJ2 lead, Fiji maintainer -
http://imagej.net/User:RuedenDid you know ImageJ has a forum?
http://forum.imagej.net/On Wed, May 25, 2016 at 1:22 PM, Bill Christens-Barry <
[hidden email]>
wrote:
> Gabriel,
>
> I think you are right that having built-in flexibility in labeling
> duplicated images as an alternative to running a macro would be a useful
> time and effort saver.
>
> A related thought regarding duplication of image windows, though not
> specific to image stack windows:
>
> If I open a TIFF image or save a new image window as a TIFF, the title of
> the window then includes the ".tif" extension (on my MacOS 10 machines).
> Apart from metadata that is specific to TIFF format files of for reminding
> the user that the image exists as a stored file, I don't see why indicating
> the file format in the window title really pertains to an open image
> window. And since the default "Save"behavior for image windows is to use
> TIFF format, I don't see any gain for ImageJ in maintaining the ".tif"
> extension in the window title or loss if this extension is eliminated.
>
> I often then use a function to remove a file extension from a window name,
> like this:
>
> dotIndex = indexOf(oName, ".");
> if (dotIndex >= 0)
> nName = substring(oName, 0, dotIndex);
> rename(nName);
>
> If a window name might have multiple "." characters in it (I've prevented
> this possibility elsewhere in my code), then a test for this is needed.
>
> It might be good to have a persistent option to automatically suppress the
> ".tif" extension (and perhaps all extensions) from window titles.
>
> Bill Christens-Barry
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html