Start this notebook with DEBUG=matrixscreener ipython notebook for debug output.
In [1]:
import py
from py import path
root = path.local.get_temproot()
root.join('stitch-notebook').remove()
tmpdir = root.mkdir('stitch-notebook')
tmpdir.mkdir('stitched')
Out[1]:
In [2]:
def experiment():
from matrixscreener.experiment import Experiment
e = path.local('../tests/experiment--test')
e.copy(tmpdir.mkdir('experiment'))
return Experiment(tmpdir.join('experiment').strpath)
In [3]:
e = experiment()
In [4]:
e
Out[4]:
In [5]:
e.stitch(folder=tmpdir.join('stitched').strpath)
Out[5]:
In [25]:
macro = ['run("Grid/Collection stitching", "type=[Filename defined position] order=[Defined by filename ] grid_size_x=1 grid_size_y=2 tile_overlap=10 first_file_index_x=0 first_file_index_y=0 directory=[/var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00] file_names=field--X{xx}--Y{yy}/image--L00--S00--U00--V00--J20--E00--O00--X{xx}--Y{yy}--T00--Z00--C00.tif output_textfile_name=TileConfiguration.txt fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50 compute_overlap subpixel_accuracy computation_parameters=[Save computation time (but use more RAM)] image_output=[Fused and display]"); selectWindow("Fused"); run("Save", "save=[/var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00/../../../stitched/stitched--U00--V00--C00--Z00.png]"); close();', 'run("Grid/Collection stitching", "type=[Filename defined position] order=[Defined by filename ] grid_size_x=1 grid_size_y=2 tile_overlap=10 first_file_index_x=0 first_file_index_y=0 directory=[/var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00] file_names=field--X{xx}--Y{yy}/image--L00--S00--U00--V00--J20--E00--O00--X{xx}--Y{yy}--T00--Z00--C01.tif output_textfile_name=TileConfiguration.txt fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50 compute_overlap subpixel_accuracy computation_parameters=[Save computation time (but use more RAM)] image_output=[Fused and display]"); selectWindow("Fused"); run("Save", "save=[/var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00/../../../stitched/stitched--U00--V00--C00--Z00.png]"); close();']
In [14]:
len(macro)
Out[14]:
In [12]:
!ls /var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00/../../../
In [26]:
macro = ' '.join(macro)
In [29]:
print(macro)
In [30]:
%%writefile macro.ijm
run("Grid/Collection stitching", "type=[Filename defined position] order=[Defined by filename ] grid_size_x=1 grid_size_y=2 tile_overlap=10 first_file_index_x=0 first_file_index_y=0 directory=[/var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00] file_names=field--X{xx}--Y{yy}/image--L00--S00--U00--V00--J20--E00--O00--X{xx}--Y{yy}--T00--Z00--C00.tif output_textfile_name=TileConfiguration.txt fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50 compute_overlap subpixel_accuracy computation_parameters=[Save computation time (but use more RAM)] image_output=[Fused and display]"); selectWindow("Fused"); run("Save", "save=[/var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00/../../../stitched/stitched--U00--V00--C00--Z00.png]"); close(); run("Grid/Collection stitching", "type=[Filename defined position] order=[Defined by filename ] grid_size_x=1 grid_size_y=2 tile_overlap=10 first_file_index_x=0 first_file_index_y=0 directory=[/var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00] file_names=field--X{xx}--Y{yy}/image--L00--S00--U00--V00--J20--E00--O00--X{xx}--Y{yy}--T00--Z00--C01.tif output_textfile_name=TileConfiguration.txt fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50 compute_overlap subpixel_accuracy computation_parameters=[Save computation time (but use more RAM)] image_output=[Fused and display]"); selectWindow("Fused"); run("Save", "save=[/var/folders/mx/t9hzs5852cxgk0548k1vdsxr0000gn/T/stitch-notebook/experiment/slide--S00/chamber--U00--V00/../../../stitched/stitched--U00--V00--C00--Z00.png]"); close();
In [32]:
!ls
In [8]:
from matrixscreener.experiment import attributes
In [9]:
attr = attributes(e.images[0])
In [26]:
'--U{U}--V{V}'.format(**attr._asdict())
Out[26]: