Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Z-drift and XY stabilization #103

Closed
wants to merge 17 commits into from
Closed

Conversation

edyoshikun
Copy link
Contributor

@edyoshikun edyoshikun commented Nov 4, 2023

This PR has the code for:

  • Calculating the z-drift and returning a z-translation matrix for timelapses
  • Calculating the xy-translation and returning a xy-translation matrices for timelapses
  • CLI call for running the stabilization

The PR can be merged to registration_v2 or to main after registration_v2 is merged.

@edyoshikun edyoshikun marked this pull request as ready for review November 6, 2023 19:33
@edyoshikun edyoshikun changed the title Z-drift stabilization Z-drift and XY stabilization Nov 6, 2023
LAMBDA_ILL = 0.500
Z_CHUNK = 5

def estimate_position_focus(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@talonchandler this function will help process multiple positions for pandas dataframe

@edyoshikun
Copy link
Contributor Author

edyoshikun commented Nov 14, 2023

@ieivanov @talonchandler this is ready for your input.
I was using this small timelapse from the opencell, but feel free to pick a different timelapse. I did some cropping

mantis stabilize-timelapse -i /hpc/projects/comp.micro/mantis/2023_11_01_OpenCell_infection/1-recon/opencell_timelapse_7_phase.zarr/0/1/000001 -o ./test_stabilization/ -j 4 -c 0 -y -z -v -s 200 200

EDIT:
mantis stabilize-timelapse -i /hpc/projects/comp.micro/mantis/2023_09_22_A549_0.52NA_illum/1-recon-phase/A549_MitoViewGreen_LysoTracker_W3_FOV5_1_phase.zarr/0/FOV0/0 -o ./test_stabilization/ -j 4 -c 0 -y -z -v -s 200 200

Couple of things to note that we can change and require your input:

  • I don't currently have a config file because I wasn't sure if we truly needed one or if we could set the values through the CLI.
  • Here, I am saving the arrays a npy. for both the z-drift and the xy-translations. Should we spit them out into a yml? The only advantage is that we can actually open a yaml file and somewhat inspect the matrices.
  • The output is saved into a folder rather than a typical .zarr as we do in other pipelines. This folder will contain all the outputs (i.e npy files, png files, csv and the zarr). Do we want to change this?
  • This function uses it's custom mantis.utils.apply_stabilization_over_time_ants() vs the one we use for deskew, label-free recons, registration process_single_position(). We can rename the functions.

@talonchandler
Copy link
Contributor

Off-the-cuff thoughts based on out quick paired session:

  • let's test on a dataset that actually needs stabilization
  • I'm fine without a config for this case...no major preference
  • I'll vote for human-readable transformations over .npy
  • mantis.utils.apply_stabilization_over_time_ants() is fine for now IMO

@edyoshikun
Copy link
Contributor Author

This is being replaced by #108

@edyoshikun edyoshikun closed this Dec 8, 2023
@edyoshikun edyoshikun deleted the stabilization branch December 8, 2023 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants