http://imagej.273.s1.nabble.com/Creating-individual-tiles-from-large-montage-file-tp5016947p5016952.html
I couldn't resist checking my email again tonight to see if you had a solution for me! Thank you so much for this. It is working absolutely brilliantly.
It also helps me to understand the syntax better as I can see now what I was doing wrong and I'll be able to use this code for other macros too. I'm sure it will also be helpful to others.
Thanks again.
folder with File.makeDirectory.
parameter string.
Jerome.
run("Image Sequence... ", "format=TIFF name=["+ imgName +"] start=0
> Thanks Jerome,
>
> I can now get the correct naming! The extension is still there as part of
> the name but that doesn't matter.
>
> I'd like to have the files going into a specified Destination folder, dir2
> so that it's a bit more generic.
>
> How would I add in that step?
>
> I've used the code below before for saving individual files into folders
> but not for a sequence;
>
> saveAs("TIFF", dir2 + title);
> close();
>
> }
>
> So, I’m assuming I can somehow adapt this...?
>
> Cheers,
>
> Jacqui
>
> Jacqueline Ross
> Biomedical Imaging Microscopist
> Biomedical Imaging Research Unit
> School of Medical Sciences
> Faculty of Medical & Health Sciences
> The University of Auckland
> Private Bag 92019
> Auckland 1142, NEW ZEALAND
>
> Tel: 64 9 923 7438
> Fax: 64 9 373 7484
>
>
http://www.fmhs.auckland.ac.nz/sms/biru/>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of
> Jerome Mutterer
> Sent: Friday, 29 July 2016 7:19 p.m.
> To:
[hidden email]
> Subject: Re: Creating individual tiles from large montage file
>
> Dear Jacqui,
> the getTilte() function works as expected, but because you have spaces in
> the tilte, you should add square brackets in the "Image Sequence..."
> command arguments. You can also specify the output folder using the save
> parameter, like this:
>
> run("Image Sequence... ", "format=TIFF name=["+ imgName +"] start=0
> digits=4
> save=/Users/jmutterer/Desktop/aaa");
>
> Sincerely,
>
> Jerome
>
>
> On 29 July 2016 at 09:05, Jacqui Ross <
[hidden email]> wrote:
>
> > Dear All,
> >
> > We have a system that creates very large stitched images from individual
> > raw data files. I'm helping one of our graduate students to do some image
> > analysis and unfortunately her files are far too large to be able to
> > process the stitched image and she has somehow forgotten to copy and
> store
> > safely the raw data, which we often use for the analysis.
> >
> > So, I would like to create a macro that will cut these large images into
> > tiles of a size that can be managed, i.e. reverse the process.
> >
> > I've made some progress but have two issues. One is that her file names
> > have spaces in them. When I use the ImgName=getTitle() command, it seems
> to
> > cut off the title at the space. Is there another command that can be used
> > that will get the full name including spaces? If not, is there an easy
> way
> > to rename these images with underscore or hyphens in place of spaces as a
> > first step?
> >
> > The second problem is that instead of saving the image stack
> automatically
> > as a sequence, it's asking me to confirm the file name. It might just be
> > that it's late on a Friday afternoon (for me) but I can't work out what
> > I've done wrong.
> >
> > I've copied the macro below and I would very much appreciate some help !
> > I've also attached it as a text file in case something goes wrong with
> the
> > lines..
> >
> >
> > //This macro splits a stitched image into 5 x 5 individual tiles and
> saves
> > as a sequence into a Destination folder
> > dir1 = getDirectory("Choose Source Directory ");
> > dir2 = getDirectory("Choose Destination Directory ");
> > list = getFileList(dir1);
> > setBatchMode(true);
> > for (i=0; i<list.length; i++) {
> > showProgress(i+1, list.length);
> > open(dir1+list[i]);
> > imgName=getTitle();
> > run("Montage to Stack...", "images_per_row=5 images_per_column=5
> > border=0");
> > run("Image Sequence... ", "format=TIFF name="+imgName+"start=0
> digits=3");
> > close();
> >
> > }
> >
> > Kind regards,
> >
> > Jacqui
> >
> > Jacqueline Ross
> > Biomedical Imaging Microscopist
> > Biomedical Imaging Research Unit
> > School of Medical Sciences
> > Faculty of Medical & Health Sciences
> > The University of Auckland
> > Private Bag 92019
> > Auckland 1142, NEW ZEALAND
> >
> > Tel: 64 9 923 7438
> > Fax: 64 9 373 7484
> >
> >
http://www.fmhs.auckland.ac.nz/sms/biru/> >
> >
> > --
> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >
>
>
>
> --
> Jerome Mutterer
> CNRS - Institut de biologie moléculaire des plantes
> 12, rue du Général Zimmer
> 67084 Strasbourg Cedex
> www.ibmp.cnrs.fr
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>