Login  Register

Creating individual tiles from one large image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Creating individual tiles from one large image

Jacqueline Ross
196 posts
Hi All,

We have a slide-scanner which images sequentially across a tissue section and then creates a large composite tiled image. We can output the files as individual tiles as well in RAW format.

However, I am attempting to assist a few students who have deleted the individual tile files and now want to divide their images into individual tiles (e.g.512 x 512 pixels) for the analysis.

So what we need to do is divide the large image into separate tiles and output them as an image sequence.

I thought I could do it by creating rectangles and cropping or duplicating but can't work out how to get it working across the entire image. Can anyone help me with this?

I'm starting to think it might be easier to rescan the sections and get the raw data again!

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
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Creating individual tiles from one large image

John Kielkopf
5 posts
The opensource BioImage Convert may do this since it handles a variety of
file types:

http://bioimage.ucsb.edu/downloads/BioImage%20Convert

They have executables for Windows, Mac, and Linux.

An example from their website for making tiles is:

imgcnv -i MY_INPUT_IMAGE.jpg -o MY_OUT_FOLDER/MY_OUT_BASE_NAME.jpg -t
jpeg -tile 256


Alternatively, there's a powerful Python script "tilemaker.py" that is
easily modified for special tasks.

http://code.google.com/p/panojs/source/browse/trunk/scripts/tilemaker.py?r=2

although it handles a more limited set of file types supported by the
Python PIL library.





On Thu, Oct 11, 2012 at 1:22 AM, Jacqui Ross <[hidden email]>wrote:

> Hi All,
>
> We have a slide-scanner which images sequentially across a tissue section
> and then creates a large composite tiled image. We can output the files as
> individual tiles as well in RAW format.
>
> However, I am attempting to assist a few students who have deleted the
> individual tile files and now want to divide their images into individual
> tiles (e.g.512 x 512 pixels) for the analysis.
>
> So what we need to do is divide the large image into separate tiles and
> output them as an image sequence.
>
> I thought I could do it by creating rectangles and cropping or duplicating
> but can't work out how to get it working across the entire image. Can
> anyone help me with this?
>
> I'm starting to think it might be easier to rescan the sections and get
> the raw data again!
>
> 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
>
> --
> John Kielkopf
> Professor of Physics and Astronomy
> University of Louisville
> Louisville, KY 40292
> Tel:502.852.5990
> Fax:502.852.0742
>
>
>
>  <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
| More
Print post
Permalink

Re: Creating individual tiles from one large image

dscho
1631 posts
In reply to this post by Jacqueline Ross
Hi Jacqui,

On Thu, 11 Oct 2012, Jacqui Ross wrote:

> So what we need to do is divide the large image into separate tiles and
> output them as an image sequence.

You might want to start from this macro:

-- snip --
run("Clown (14K)");

tileWidth = 32;
tileHeight = 19;

setBatchMode(true);
original = getImageID();
width = getWidth();
height = getHeight();

stack = 0; // the ID of the output; will be created on demand
for (x = 0; x < width; x += tileWidth) {
        currentTileWidth = width - x;
        if (currentTileWidth > tileWidth)
                currentTileWidth = tileWidth;
        for (y = 0; y < height; y += tileHeight) {
                currentTileHeight = height - y;
                if (currentTileHeight > tileHeight)
                        currentTileHeight = tileHeight;

                // copy the tile
                selectImage(original);
                makeRectangle(x, y, currentTileWidth, currentTileHeight);
                run("Copy");
                run("Select None");
                if (stack == 0) {
                        newImage("Tiled " + getTitle(), "RGB",
                                tileWidth, tileHeight, 1);
                        stack = getImageID();
                } else {
                        selectImage(stack);
                        run("Add Slice");
                }
                makeRectangle(0, 0, currentTileWidth, currentTileHeight);
                run("Paste");
                setMetadata("Label", "(x=" + x + ",y=" + y + ")");
        }
}
if (stack != 0) {
        selectImage(stack);
        run("Select None");
        setSlice(1); // work around bug: the slider is at slice 1,
                // but the last slice is shown
}
setBatchMode(false);
-- snap --

Use either Fiji's script editor (File>New>Script, followed by
Language>ImageJ Macro) or the bare-bones editor of ImageJ 1.x
(Plugins>New>Macro), paste the code and modify it to your liking (you
might want to remove the line opening the clown sample, adjust the image
type of the new type or replace newImage() with a call to the Duplicate...
plugin, and maybe adjust the slice label format).

Ciao,
Johannes

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

Re: Creating individual tiles from one large image

Christian Goosmann
13 posts
In reply to this post by Jacqueline Ross
Hi Jacqui,
Jacqui Ross wrote:

> Hi All,
>
> We have a slide-scanner which images sequentially across a tissue section and then creates a large composite tiled image. We can output the files as individual tiles as well in RAW format.
>
> However, I am attempting to assist a few students who have deleted the individual tile files and now want to divide their images into individual tiles (e.g.512 x 512 pixels) for the analysis.
>
> So what we need to do is divide the large image into separate tiles and output them as an image sequence.
>
> I thought I could do it by creating rectangles and cropping or duplicating but can't work out how to get it working across the entire image. Can anyone help me with this?
>
> I'm starting to think it might be easier to rescan the sections and get the raw data again!
>
> 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
>
If you're not into writing a macro or script, you can use the in built
function 'Image>Stack>Tools>Montage to stack...' which lets you choose
how many rows and columns you want your large image split, leave border
width at 0 and you get a stack of your tiles that you can save as image
sequence.
Christian

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

Re: Creating individual tiles from one large image

ctrueden
1670 posts
In reply to this post by Jacqueline Ross
Hi Jacqui,

> So what we need to do is divide the large image into separate tiles and
> output them as an image sequence.

You can also do this using the Bio-Formats command line tools:
   http://loci.wisc.edu/bio-formats/command-line-tools

You would use a series of calls to the "bfconvert" command line tool with
the "-crop" option to create tiles sized to your liking; e.g., "-crop
0,0,512,512", "-crop 512,0,512,512", etc., up to the size of your planes in
2 dimensions.

Regards,
Curtis


On Thu, Oct 11, 2012 at 12:22 AM, Jacqui Ross <[hidden email]>wrote:

> Hi All,
>
> We have a slide-scanner which images sequentially across a tissue section
> and then creates a large composite tiled image. We can output the files as
> individual tiles as well in RAW format.
>
> However, I am attempting to assist a few students who have deleted the
> individual tile files and now want to divide their images into individual
> tiles (e.g.512 x 512 pixels) for the analysis.
>
> So what we need to do is divide the large image into separate tiles and
> output them as an image sequence.
>
> I thought I could do it by creating rectangles and cropping or duplicating
> but can't work out how to get it working across the entire image. Can
> anyone help me with this?
>
> I'm starting to think it might be easier to rescan the sections and get
> the raw data again!
>
> 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
>

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

Re: Creating individual tiles from one large image

Jacqueline Ross
196 posts
Dear Curtis, Christian, Johannes & John,

Thanks very much to each of you for your suggestions. The easiest method is the one suggested by Christian so I think the students can use that method since it doesn't really matter if the tiles are a certain size.

I haven't yet managed to get the other methods working properly but haven't had much time this week to pursue them properly.

I hope it's OK to come back to you if I have further questions.

Thanks!

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/


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Curtis Rueden
Sent: Friday, 12 October 2012 6:10 a.m.
To: [hidden email]
Subject: Re: Creating individual tiles from one large image

Hi Jacqui,

> So what we need to do is divide the large image into separate tiles
> and output them as an image sequence.

You can also do this using the Bio-Formats command line tools:
   http://loci.wisc.edu/bio-formats/command-line-tools

You would use a series of calls to the "bfconvert" command line tool with the "-crop" option to create tiles sized to your liking; e.g., "-crop 0,0,512,512", "-crop 512,0,512,512", etc., up to the size of your planes in
2 dimensions.

Regards,
Curtis


On Thu, Oct 11, 2012 at 12:22 AM, Jacqui Ross <[hidden email]>wrote:

> Hi All,
>
> We have a slide-scanner which images sequentially across a tissue
> section and then creates a large composite tiled image. We can output
> the files as individual tiles as well in RAW format.
>
> However, I am attempting to assist a few students who have deleted the
> individual tile files and now want to divide their images into
> individual tiles (e.g.512 x 512 pixels) for the analysis.
>
> So what we need to do is divide the large image into separate tiles
> and output them as an image sequence.
>
> I thought I could do it by creating rectangles and cropping or
> duplicating but can't work out how to get it working across the entire
> image. Can anyone help me with this?
>
> I'm starting to think it might be easier to rescan the sections and
> get the raw data again!
>
> 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
>

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

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