reUse Grid stitching generated coords

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

reUse Grid stitching generated coords

simone codeluppi
Hi
My goal is to stitch a multi-channels image using the coordinates or overlapping of the tiles generated in the stitching of a reference channel (ex. DAPI staining). I first run the plugin stitching the Reference channel (grid setting) saving the TileConfiguration or TileConfiguration.registered file. I then I re-run the plugin on a different channel using the "Position from file" setting from TileConfiguration or TileConfiguration.registered but the stitching result is slightly different. Is there a way to "force" the plugin to place the tiles using the previously generated coord?

Any help will be greatly appreciated.
Thanks a lot!

Simone

Reply | Threaded
Open this post in threaded view
|

Re: reUse Grid stitching generated coords

Majurski, Michael Paul (Fed)
Simone,

I do not know how to force the "Grid/Collection" stitching plugin to use a specific set of positions to assemble a new channel. As far as I understand it, using the positions from file gives the stitching tool a starting point from which to optimize translations.

However, I can add a plug for the stitching plugin we developed which I know can use coordinates generated on a previous stitching run to assemble a stitched image from new images. This seems to follow your use case of using a single channel to register the images, and then assemble stitched images from the other channels using those exact image positions.

The stitching plugin:
https://github.com/NIST-ISG/MIST

Install Guide:
https://github.com/NIST-ISG/MIST/wiki/Install-Guide

The FAQ about stitching secondary channels.
https://github.com/NIST-ISG/MIST/wiki/FAQ#how-to-stitch-from-metadata
https://github.com/NIST-ISG/MIST/wiki/FAQ#stitching-multiple-channels

Thanks,
~The NIST ISG Team
~Michael Majurski



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of simone codeluppi
Sent: Thursday, August 13, 2015 10:58 AM
To: [hidden email]
Subject: reUse Grid stitching generated coords

Hi
My goal is to stitch a multi-channels image using the coordinates or overlapping of the tiles generated in the stitching of a reference channel (ex. DAPI staining). I first run the plugin stitching the Reference channel (grid setting) saving the TileConfiguration or TileConfiguration.registered file. I then I re-run the plugin on a different channel using the "Position from file" setting from TileConfiguration or TileConfiguration.registered but the stitching result is slightly different. Is there a way to "force"
the plugin to place the tiles using the previously generated coord?

Any help will be greatly appreciated.
Thanks a lot!

Simone





--
View this message in context: http://imagej.1557.x6.nabble.com/reUse-Grid-stitching-generated-coords-tp5014013.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
Reply | Threaded
Open this post in threaded view
|

Re: reUse Grid stitching generated coords

Jason Miller
Hi Michael-

I know I am just confirming information that you have already provided on
your excellent webpage describing MIST, but we can't use MIST to force
exact stitching from a configuration file is the images to be stitched are
3d instead of 2d, correct?

Thanks so much
-Jason

-------

Jason Miller, MD, PhD

University of Michigan Kellogg Eye Center


Home address:

117 Worden Ave

Ann Arbor, MI 48103

Cell: (415) 225-2134

E-mail: *[hidden email] <[hidden email]>*


"When I was 5 years old, my mother always told me that happiness was the
key to life. When I went to school, they asked me what I wanted to be when
I grew up. I wrote down, 'Happy.' They told me I didn't understand the
assignment. I told them they didn't understand life." - John Lennon

On Thu, Aug 13, 2015 at 1:06 PM, Majurski, Michael Paul <
[hidden email]> wrote:

> Simone,
>
> I do not know how to force the "Grid/Collection" stitching plugin to use a
> specific set of positions to assemble a new channel. As far as I understand
> it, using the positions from file gives the stitching tool a starting point
> from which to optimize translations.
>
> However, I can add a plug for the stitching plugin we developed which I
> know can use coordinates generated on a previous stitching run to assemble
> a stitched image from new images. This seems to follow your use case of
> using a single channel to register the images, and then assemble stitched
> images from the other channels using those exact image positions.
>
> The stitching plugin:
> https://github.com/NIST-ISG/MIST
>
> Install Guide:
> https://github.com/NIST-ISG/MIST/wiki/Install-Guide
>
> The FAQ about stitching secondary channels.
> https://github.com/NIST-ISG/MIST/wiki/FAQ#how-to-stitch-from-metadata
> https://github.com/NIST-ISG/MIST/wiki/FAQ#stitching-multiple-channels
>
> Thanks,
> ~The NIST ISG Team
> ~Michael Majurski
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> simone codeluppi
> Sent: Thursday, August 13, 2015 10:58 AM
> To: [hidden email]
> Subject: reUse Grid stitching generated coords
>
> Hi
> My goal is to stitch a multi-channels image using the coordinates or
> overlapping of the tiles generated in the stitching of a reference channel
> (ex. DAPI staining). I first run the plugin stitching the Reference channel
> (grid setting) saving the TileConfiguration or TileConfiguration.registered
> file. I then I re-run the plugin on a different channel using the "Position
> from file" setting from TileConfiguration or TileConfiguration.registered
> but the stitching result is slightly different. Is there a way to "force"
> the plugin to place the tiles using the previously generated coord?
>
> Any help will be greatly appreciated.
> Thanks a lot!
>
> Simone
>
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/reUse-Grid-stitching-generated-coords-tp5014013.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
>

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

Re: reUse Grid stitching generated coords

Majurski, Michael Paul (Fed)
Jason,

MIST only handles grids of 2D images.

It can handle a series of independent Z planes, registering each z plane independently using the timeslices functionality (treating the Z planes as different time slices), but it cannot register a volume of images.

Thanks
~Michael Majurski



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jason Miller
Sent: Thursday, August 13, 2015 1:45 PM
To: [hidden email]
Subject: Re: reUse Grid stitching generated coords

Hi Michael-

I know I am just confirming information that you have already provided on your excellent webpage describing MIST, but we can't use MIST to force exact stitching from a configuration file is the images to be stitched are 3d instead of 2d, correct?

Thanks so much
-Jason

-------

Jason Miller, MD, PhD

University of Michigan Kellogg Eye Center


Home address:

117 Worden Ave

Ann Arbor, MI 48103

Cell: (415) 225-2134

E-mail: *[hidden email] <[hidden email]>*


"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down, 'Happy.' They told me I didn't understand the assignment. I told them they didn't understand life." - John Lennon

On Thu, Aug 13, 2015 at 1:06 PM, Majurski, Michael Paul < [hidden email]> wrote:

> Simone,
>
> I do not know how to force the "Grid/Collection" stitching plugin to
> use a specific set of positions to assemble a new channel. As far as I
> understand it, using the positions from file gives the stitching tool
> a starting point from which to optimize translations.
>
> However, I can add a plug for the stitching plugin we developed which
> I know can use coordinates generated on a previous stitching run to
> assemble a stitched image from new images. This seems to follow your
> use case of using a single channel to register the images, and then
> assemble stitched images from the other channels using those exact image positions.
>
> The stitching plugin:
> https://github.com/NIST-ISG/MIST
>
> Install Guide:
> https://github.com/NIST-ISG/MIST/wiki/Install-Guide
>
> The FAQ about stitching secondary channels.
> https://github.com/NIST-ISG/MIST/wiki/FAQ#how-to-stitch-from-metadata
> https://github.com/NIST-ISG/MIST/wiki/FAQ#stitching-multiple-channels
>
> Thanks,
> ~The NIST ISG Team
> ~Michael Majurski
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> simone codeluppi
> Sent: Thursday, August 13, 2015 10:58 AM
> To: [hidden email]
> Subject: reUse Grid stitching generated coords
>
> Hi
> My goal is to stitch a multi-channels image using the coordinates or
> overlapping of the tiles generated in the stitching of a reference
> channel (ex. DAPI staining). I first run the plugin stitching the
> Reference channel (grid setting) saving the TileConfiguration or
> TileConfiguration.registered file. I then I re-run the plugin on a
> different channel using the "Position from file" setting from
> TileConfiguration or TileConfiguration.registered but the stitching result is slightly different. Is there a way to "force"
> the plugin to place the tiles using the previously generated coord?
>
> Any help will be greatly appreciated.
> Thanks a lot!
>
> Simone
>
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/reUse-Grid-stitching-generated-coords
> -tp5014013.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
>

--
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: reUse Grid stitching generated coords

vbindokas
In reply to this post by simone codeluppi
You can apply the TileConfiguration transformation to other data, as
long as the TEXT is made to match the new data. We do this on big data
that would not all fit into RAM, so the case below is for input data
from individual tifs with the common XY_Z_C_etc naming scheme. This
macro code works on Leica exported data and illustrates how to go about
it. [WARNING pasted code is likely to have long lines split; best to use
attached IJM (if it makes it as attachment)]. The Z matching option
seems to give incorrect results for our data. The default linear blend
fusion is likewise often too obvious, so I favor the 'random intensity'
fusions. The tolerances for accepting tiles are deliberately set low so
as to prevent loss of tiles with little data and in a grid of known layout.
You can use the macro recorder to generate other fusion options (an
extremely long text line!), and insert as needed.
__________macro start cut__________________________________________

/*Macro to apply a common transform to align and stitch 3D mosaics using
FIJI Grid/Collection plugin
  * Specific case is for Leica LIF data, using a specific channel as a
reference; for BIG DATA!
  * Since bioformats fails to correctly open LIF tile scanning order,
this macro requires export to single tifs
  *  and pulls in all stage/CH/Z files for stitching. PREP WORK:
  *       Open a Leica merge to count up the RxC values used in capture
  *       EXPORT_AS_TIF the LIF file into a folder using Leica software,
and create a separate output folder
  *       Look at last export files to get Z step numbers, BUT, ADD ONE
[starts with zero not 1]
  *       RefCH is main reference for all others --fit performed for
RefCH and then same is applied to all other channels
  *       and then assembles all into a composite stack [if memory allows]
  *       This macro EDITS the transformation text file to call each
channel (so you don't have to manually!) serially
  *     You can edit the code below for other stitching options; default
is to ignore Z shifts and use random intensity blending [best options!]
  *              <v8 bug fixes: input dimensions, plus max projection
generation at end
  *       Code is for current FIJI, all features as default plugins/features
  *       this pads names for grid stitcher with leading zeros to 999
stage locales
  * V.Bindokas, Univ of Chicago, JULY 2015
  */

run("Close All");
Dialog.create("setup");
   Dialog.addNumber("tiles across", 5);
   Dialog.addNumber("vertical", 7);
   Dialog.addNumber("Ch", 4);
   Dialog.addNumber("Z", 3);
   Dialog.addNumber("RefCH", 1);
   Dialog.show();
   Xs = Dialog.getNumber()"Rows";        //order read is order above!
   Ys = Dialog.getNumber()"Col";
   ch = Dialog.getNumber()"Ch";
   z = Dialog.getNumber()"Z";
   st = Xs * Ys;
   ref= Dialog.getNumber()"RefCH";
d1=getDirectory("Choose input Directory");
li=getFileList(d1);
d2=getDirectory("Choose output Directory");
fup=d1+li[1];

for (S=0; S<st; S++){        //this makes blocks of images the tiler
seems to require
         if (st>9 && S<10) ss="0"+toString(S); //stringify and pad
counter value to match leica naming scheme [number of digits]
         else ss=toString(S);
         if (st>99 && S<100 ) ss="0"+ss; //stringify and pad, add
another zero for the big-job folks...
     run("Image Sequence...", "open=[fup] file=_s"+ss+" sort");    
//import all files per stage position
     run("Stack to Hyperstack...", "order=xyczt(default) channels=&ch
slices=&z frames=1 display=Color");
     run("Gaussian Blur...", "sigma=1 stack"); //denoise all, just a touch
     run("Split Channels");
     for (h=ch;h>=1;h--){
         pa=d2+"S"+ss+"_C"+h+".tif";
         saveAs("Tiff", pa);                    //write out data for
stitching, keeping memory needs lower
         close();
     }    //for h
}   //for S




       //recorded stitch setup below basically keeps every tile sans
'calculation' of fits to avoid the common goof ups dropping things or
shifting Z for no good end
       //change to whatever you feel like trying. The alignment map is
then applied to all other channels vs trying to fit each independently.
So, make sure reference CH is a good one!
if (st>9 && st<99){
run("Grid/Collection stitching", "type=[Grid: row-by-row] order=[Right &
Up] grid_size_x=&Xs grid_size_y=&Ys tile_overlap=10 first_file_index_i=0
directory=[&d2] file_names=S{ii}_C"+ref+".tif
output_textfile_name=TileConfiguration.txt fusion_method=[Intensity of
random input tile] regression_threshold=0.00
max/avg_displacement_threshold=115 absolute_displacement_threshold=333
ignore_z_stage subpixel_accuracy display_fusion
computation_parameters=[Save computation time (but use more RAM)]
image_output=[Fuse and display]");
}
if (st>99 ){
run("Grid/Collection stitching", "type=[Grid: row-by-row] order=[Right &
Up] grid_size_x=&Xs grid_size_y=&Ys tile_overlap=10 first_file_index_i=0
directory=[&d2] file_names=S{iii}_C"+ref+".tif
output_textfile_name=TileConfiguration.txt fusion_method=[Intensity of
random input tile] regression_threshold=0.00
max/avg_displacement_threshold=115 absolute_displacement_threshold=333
ignore_z_stage subpixel_accuracy display_fusion
computation_parameters=[Save computation time (but use more RAM)]
image_output=[Fuse and display]");
}
else {
run("Grid/Collection stitching", "type=[Grid: row-by-row] order=[Right &
Up] grid_size_x=&Xs grid_size_y=&Ys tile_overlap=10 first_file_index_i=0
directory=[&d2] file_names=S{i}_C"+ref+".tif
output_textfile_name=TileConfiguration.txt fusion_method=[Intensity of
random input tile] regression_threshold=0.00
max/avg_displacement_threshold=115 absolute_displacement_threshold=333
ignore_z_stage subpixel_accuracy display_fusion
computation_parameters=[Save computation time (but use more RAM)]
image_output=[Fuse and display]");
}
pa="fused_ch"+ref+".tif";
saveAs("Tiff", d2+pa);
close();


dx = newArray("1");            //build array for doing other channels
if (ch>1){
     for (dxi=2; dxi<=ch; dxi++){
         dx=Array.concat(dx, dxi);
         //Array.print(dx);//
     }

     for (i=0;i<ch; i++){                // BE AWARE array index starts
as ZERO not 1
         if ( parseInt(dx[i]) != ref){
             A="_C"+toString(ref);
             B="_C"+toString(parseInt(dx[i]));
             nu=d2+"next.txt";        //register data map with next CH
in names vs CH<ref> of 1st run
             fi=d2+"TileConfiguration.txt";
             str=File.openAsString(fi);
             rows=split(str, "\n");
             x=newArray(rows.length);
                 for(k=0; k<rows.length; k++){            //do the
filename string edits for new input
                     rows[k]=replace(rows[k], A, B);
                     print(rows[k]);
                     File.append(rows[k], nu);
                     File.append("\r", nu);
                 }
             //apply stitiching and write result to disk
             run("Grid/Collection stitching", "type=[Positions from
file] order=[Defined by TileConfiguration] directory=[&d2]
layout_file=next.txt fusion_method=[Intensity of random input tile]
regression_threshold=0.00 max/avg_displacement_threshold=115
absolute_displacement_threshold=333 ignore_z_stage subpixel_accuracy
display_fusion computation_parameters=[Save computation time (but use
more RAM)] image_output=[Fuse and display]");
             pa="fused_ch"+(dx[i])+".tif";
             saveAs("Tiff", d2+pa);
             File.delete(nu);
             close();
         }    //end if not ref CH
     }    //end for all CH
}    //end ch>1

//pull all CH output back in for building the large composite
for (i=1;i<=ch; i++){
     run("Bio-Formats Importer", "open=["+d2+"fused_ch"+i+".tif]
color_mode=Default view=Hyperstack stack_order=XYCZT");    //virtual
stack has bug--- not doing Z!
}
Stack.getDimensions(width, height, channels, slices, frames);
run("Concatenate...", "all_open title=all");
run("Stack to Hyperstack...", "order=xyzct channels=&ch slices=&slices
frames=1 display=Composite");    //you can add steps to set colors
specifically after this line, if you need to
pa="fused_merged.tif";
saveAs("Tiff", d2+pa);
run("Z Project...", "projection=[Max Intensity]");

__________macro end____________________

On 8/13/2015 9:57 AM, simone codeluppi wrote:

> Hi
> My goal is to stitch a multi-channels image using the coordinates or
> overlapping of the tiles generated in the stitching of a reference channel
> (ex. DAPI staining). I first run the plugin stitching the Reference channel
> (grid setting) saving the TileConfiguration or TileConfiguration.registered
> file. I then I re-run the plugin on a different channel using the "Position
> from file" setting from TileConfiguration or TileConfiguration.registered
> but the stitching result is slightly different. Is there a way to "force"
> the plugin to place the tiles using the previously generated coord?
>
> Any help will be greatly appreciated.
> Thanks a lot!
>
> Simone
>
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/reUse-Grid-stitching-generated-coords-tp5014013.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
__

Vytas Bindokas, Ph.D.
Research Assoc. (Assoc. Prof.),
Director, BSD Light Microscopy Core Facility
phone: 773-702-4875

      [address for letters ONLY (see shipping addr below):]
Dept Pharmacol Physiol Sci MC0926
947 E 58th Street
The University of Chicago
Chicago IL 60637
Room Abbott 129


shipping address (main KCBD site):
V. Bindokas
900 E 57th Street
KCBD room 1250, Microscopy Core
The University of Chicago
Chicago IL 60637


email [hidden email]
web site for LMCF:
http://digital.uchicago.edu/index.html


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

LIFtile_restitcher v8.ijm (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: reUse Grid stitching generated coords

Niko Ehrenfeuchter
In reply to this post by simone codeluppi
Hi Simone,

simply switch off the "compute overlap" option when re-using the
coordinates from a previous run.

For more details, see here:

http://fiji.sc/Image_Stitching

Cheers
Niko

On 13.08.2015 16:57, simone codeluppi wrote:

> Hi
> My goal is to stitch a multi-channels image using the coordinates or
> overlapping of the tiles generated in the stitching of a reference channel
> (ex. DAPI staining). I first run the plugin stitching the Reference channel
> (grid setting) saving the TileConfiguration or TileConfiguration.registered
> file. I then I re-run the plugin on a different channel using the "Position
> from file" setting from TileConfiguration or TileConfiguration.registered
> but the stitching result is slightly different. Is there a way to "force"
> the plugin to place the tiles using the previously generated coord?
>
> Any help will be greatly appreciated.
> Thanks a lot!
>
> Simone
>
>
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/reUse-Grid-stitching-generated-coords-tp5014013.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
Niko Ehrenfeuchter | Image Analysis Specialist | Biozentrum, University
of Basel | Klingelbergstr. 50/70 | CH-4056 Basel
Phone: +41 (61) 26 72673 | [hidden email] |
www.biozentrum.unibas.ch | www.microscopynetwork.unibas.ch

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

Re: reUse Grid stitching generated coords

simone codeluppi
Thanks a lot for all the replies!

I tested MIST and works very well on the dataset.
I also tweaked the script from Vytas with the settings suggested from Niko and this also does the trick as long as the coords file provided is the TilesConfiguration.registered.txt

thanks!

Simone