Hello, please is there any possibility how to split one image into several independent parts (i.e. to halfs, quaters) ? Thank for answer
-- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Lenka,
> how to split one image into several independent parts Here is a macro that chops an image into NxN tiles, where N is the number of divisions you choose: n = getNumber("How many divisions (e.g., 2 means quarters)?", 2); id = getImageID(); title = getTitle(); getLocationAndSize(locX, locY, sizeW, sizeH); width = getWidth(); height = getHeight(); tileWidth = width / n; tileHeight = height / n; for (y = 0; y < n; y++) { offsetY = y * height / n; for (x = 0; x < n; x++) { offsetX = x * width / n; selectImage(id); call("ij.gui.ImageWindow.setNextLocation", locX + offsetX, locY + offsetY); tileTitle = title + " [" + x + "," + y + "]"; run("Duplicate...", "title=" + tileTitle); makeRectangle(offsetX, offsetY, tileWidth, tileHeight); run("Crop"); } } selectImage(id); close(); HTH, Curtis On Mon, Jan 14, 2013 at 2:56 PM, Lenka Polaskova <[hidden email] > wrote: > Hello, please is there any possibility how to split one image into several > independent parts (i.e. to halfs, quaters) ? Thank for answer > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Lenka Polaskova
There are a lot of ways to do this.
Look at the command Image > Stacks > Tools > Montage To Stack... Or for more flexibility, macros like this can be written. macro "split horizontally" { original = getImageID; title = getTitle; height = getHeight; width = getWidth; halfWidth = width / 2; makeRectangle(0, 0, halfWidth, height); run("Duplicate...", "title=left_"+title+" duplicate"); selectImage(original); makeRectangle(halfWidth+1, 0, halfWidth, height); run("Crop"); rename("right_"+title); } ________________________________________________________ Michael Cammer, Assistant Research Scientist Skirball Institute of Biomolecular Medicine Lab: (212) 263-3208 Cell: (914) 309-3270 -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Lenka Polaskova Sent: Monday, January 14, 2013 3:57 PM To: [hidden email] Subject: split image Hello, please is there any possibility how to split one image into several independent parts (i.e. to halfs, quaters) ? Thank for answer -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Lenka Polaskova
The answer is positive, for that Ive been using a image spliting dll control in my image developing, using image spliting function, users can split multi-page image into one single pages, users also split a image into different parts.
|
it would be easy to split large image files into small and separate parts as long as you have releveant image splitting control.
here is a tiff splitting control, give a try. |
In reply to this post by ctrueden
Dear Curtis,
I am taking 4x4 confocal tiles with a 40x/1.4NA objective with 2x oversampling (following nyquist criterion); meaning, my slices are rather thin.
Because of mounting and/or uneven illumination, the images in the tile are not in the same focal plane. To solve this, I have borrowed your code to split the titles into 16 images (thank you very much for the code, by the way), I then find the bottom of the cells in each image and crop stacks to the same dimensions for reassembly with all images in the same focal plane.
Now I want to put the tile back together.
In my splitting I named each image with coordinates _x{x}_y{y} so I could reassemble them using Preibisch's Grid/Collection Stitching Plugin. The problem is my slices are rather thin (0.33um) and after reassembling the image I obtain jumbled channels. I do not want to copy each slice several times to do the stitching (as recommended), just to have to remove them later. Each original tile is a bit shy of 1Gb as it is.
If at all possible, I would rather put the tile back together the same way I took it apart.
I have been trying to find a solution but it has evaded me.
These images have no overlap, but I know how to put them together using the _x{x}_y{y} coordinates, is there a way to reassemble the 4x4 tile without FFT and data jumbling?
What would you suggest?
Thank you very much in advance!!
All best,
Andrés
|
I forgot to add. I have tried the Stack Combiner function and it will not work. Do not know why...
|
OK
|
In reply to this post by ALR
Hi Andrés,
> is there a way to reassemble the 4x4 tile without FFT and data jumbling? The Stitching plugin is one decent way to go. That plugin has two steps, overlap computation and fusion; my understanding is that Fourier space is only used for the overlap computation step. The plugin has a "compute overlap" option you can uncheck to skip that in favor of using coordinates provided from elsewhere (typically a TileConfiguration.txt file). But given that you have exactly zero overlap, even that fusion step is overkill. You might be better served by: - Creating the new full size image as a blank - Using ImageJ's copy & paste functionality to paste each tile onto the proper position of the big image Unfortunately, I couldn't see a function to control where the paste happens (it is centered by default). The low-level API is there to do it somewhere else, though it would take some digging in the IJ1 code [1] to figure it out. Regards, Curtis [1] https://github.com/imagej/ImageJA/blob/v1.49r/src/main/java/ij/gui/Roi.java#L1352-L1359 On Mon, Apr 20, 2015 at 2:33 PM, ALR < [hidden email]> wrote: > I forgot to add. I have tried the Stack Combiner function and it will not > work. Do not know why... > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/split-image-tp5001409p5012541.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |