AllenInstitute / ophys_etl_pipelines

Pipelines and modules for processing optical physiology data
Other
9 stars 5 forks source link

Create process to generate Scientifica 2p dewarping parameters #80

Open wbwakeman opened 3 years ago

wbwakeman commented 3 years ago

The Scientifica dewarping module dewarps the two-photon movies based on a set of four transformation parameters that are specific to each rig. These values are recorded in LIMS and are provided to the module by the LIMS dewarping strategy. The operations group generates a grid-like "graticule" file each time they make a significant change to a rig. There is an automated mechanism to upload these to LIMS and convert them from the .raw format to an HDF5 file.

This LIMS database query will return the paths to the graticule files:

SELECT sp.name, sp.storage_directory || im.jp2 AS converted_graticule_file, im.created_at, im.id AS im_id, sc.path, sc.resolution
FROM specimens sp JOIN images im ON im.specimen_id=sp.id JOIN image_types imt ON imt.id=im.image_type_id AND imt.name = 'Graticule'
LEFT JOIN scans sc ON sc.image_id=im.id AND sc.superseded = 'f'
WHERE sp.name LIKE 'ScientificaGraticule%'
ORDER BY --sp.name, 
im.created_at;

We need an improved process for generating the four transformation parameters that are used to do the dewarping.

The original process went like this: Convert the HDF5 stack to a TIFF Use ImageJ to read the TIFF Do stack average OR max_projection to 8bit.png (Image|Stacks|Z Project...) View 8bit.png warped image and use that as input to: /allen/aibs/technology/waynew/ophys/sine_dewarp_gridtest_last.py gridimagein 2pnumber gridimageout where output is the four numbers, and an image of the dewarped input If the image looks good, done; else manual tweak Record the four values in LIMS

The sine_dewarp_grid script is also available in this gist: https://gist.github.com/wbwakeman/b8719e0ad5b1b6486482974f410ab086

wbwakeman commented 3 years ago

Scientifica scanners are now offline. Only need to pick this up when (if) they plan on starting them up again. Operations was requested to give us plenty of notice if that happens so that we can start to take on tasks like this