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

Motion tracking ID matches #20

Closed
CodyCBakerPhD opened this issue Jun 27, 2024 · 0 comments
Closed

Motion tracking ID matches #20

CodyCBakerPhD opened this issue Jun 27, 2024 · 0 comments
Assignees

Comments

@CodyCBakerPhD
Copy link
Member

CodyCBakerPhD commented Jun 27, 2024

Though the brains.json for the pumpprobe indeed has XYZ coordinates for ROIs tracked over the entire functional imaging, it only has data for the number (and thus local IDs) seen on the 30th frame, and though it tracked (via nInVolume) the number of such ROIs in each volume, it does not track which local IDs (which could correspond to the 30th frame) each coordinate corresponds to in each volume

A helper script...

import json
import pathlib
import pickle

import numpy

BASE_FOLDER_PATH = pathlib.Path("D:/Leifer")
SESSION_FOLDER_PATH = BASE_FOLDER_PATH / "20211104"
# LOGBOOK_FILE_PATH = SESSION_FOLDER_PATH / "logbook.txt"

PUMPPROBE_FOLDER_PATH = SESSION_FOLDER_PATH / "pumpprobe_20211104_163944"
MULTICOLOR_FOLDER_PATH = SESSION_FOLDER_PATH / "multicolorworm_20211104_162630"

multicolor_brains_file_path = MULTICOLOR_FOLDER_PATH / "brains.json"
with open(file=multicolor_brains_file_path, mode="r") as io:
    multicolor_brains_info = json.load(fp=io)

pumpprobe_brains_file_path = PUMPPROBE_FOLDER_PATH / "brains.json"
with open(file=pumpprobe_brains_file_path, mode="r") as io:
    pumpprobe_brains_info = json.load(fp=io)

matches_file_path = PUMPPROBE_FOLDER_PATH / "matches.pickle"
with open(file=matches_file_path, mode="rb") as io:
    matches_info = pickle.load(file=io)

red_signal_file_path = PUMPPROBE_FOLDER_PATH / "red.pickle"
with open(file=red_signal_file_path, mode="rb") as io:
    red_signal_info = pickle.load(file=io)

green_signal_file_path = PUMPPROBE_FOLDER_PATH / "green.pickle"
with open(file=green_signal_file_path, mode="rb") as io:
    green_signal_info = pickle.load(file=io)

print(f"PumpProbe brains 'nInVolume' for volume 0: {pumpprobe_brains_info['nInVolume'][0]}")
print(f"Number of non-nan masked indices in PumpProbe greed signal: {sum(green_signal_info.nan_mask[0,:] == False)}")
print(f"Number of non-nan masked indices in PumpProbe red signal: {sum(red_signal_info.nan_mask[0,:] == False)}")
print(f"Number of non-'-1' values in 'MMatch': {sum(matches_info['MMatch'][0,:] != -1)}")

print(f"Maximum number of 'nInVolume' over all volumes: {max(pumpprobe_brains_info['nInVolume'])}")
print(f"Length of all second axes of data objects (red/green signals and matches): {green_signal_info.data.shape[1]}")
print(f"Number of ROIs in the 30th frame (used to coregister): {pumpprobe_brains_info['nInVolume'][30]}")

# Conclusion: the 'coordZYX' of the signal pickle files do correspond to the 'nInVolume', but this does not
# itself match the ROI IDs used for data extraction (particular to 30th frame) and since no IDs are stored per coord
# They would have to be recomputed...
@CodyCBakerPhD CodyCBakerPhD self-assigned this Jun 27, 2024
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

No branches or pull requests

1 participant