BWHCNI / workflow

A collection of workflow scripts related to OpenMIMS
0 stars 2 forks source link

mosiac_nrrd: mosaic tile nrrds incorrectly referenced in OM #2

Closed cpoczatek closed 8 years ago

cpoczatek commented 8 years ago

On mosaic nrrd files OpenMIMS reads references in the header for file names and stage coordinates of the individual tiles, and maps the pixel position of the mouse on an image to the correct file. This appears to be broken. It looks like this is happening because the stage position and raster fields are written incorrectly to the mosaic nrrd file.

To reproduce, in a terminal run:

wget https://github.com/BWHCNI/workflow/raw/master/mosaic_nrrd/test_data/090708-2-1_{11,12,13,14}-4x10.nrrd
mosaic_nrrd -t fluid -o test.nrrd 090708-2-1_1*.nrrd
unu head test.nrrd | grep tile

Mims_tile_positions:=090708-2-1_11-4x10.nrrd,-842,-12937;090708-2-1_12-4x10.nrrd,-842,-12857;090708-2-1_13-4x10.nrrd,-762,-12857;090708-2-1_14-4x10.nrrd,-762,-12937

Here we can see that the tile positions (which is the center of each image) are on an 80x80 micron grid. But if we compare the nrrd header of the new file to the existing example in the repo, there are 2 fields that are different.

wget https://github.com/BWHCNI/workflow/raw/master/mosaic_nrrd/test_data/mosaic_fluid.nrrd
diff -y --suppress-common-lines <(unu head test.nrrd) <(unu head mosaic_fluid.nrrd)

Mims_position:=-842,-12937                    | Mims_position:=-802,-12897
Mims_raster:=79939                        | Mims_raster:=160,160

At some point we changed the script to record a 2D raster size and shift the stage position to the center of the mosaic. This is a regression, and I'm not sure when it happened. Maybe the change was lost in the svn->git migration because it wasn't committed? I need to search for other versions on the file server.

cpoczatek commented 8 years ago

Should be fixed. Added quick test script. Noticed additional bugs with grid mode.