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

Add files to allow conversion to IBL format #36

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jonahpearl
Copy link

Hi Andy — I'm enjoying using AP histology, thanks for building it! Here I provide two additions and a hopefully minor change:

  1. allow export to npy files based on your code here. I added a tab to the GUI for this.
  2. I added a python script that takes the output probe_ccf.npy (or the multi-shank version) and converts that into the xyz_picks (or the multi shank version) required by the IBL atlas ephys gui.
  3. very minor-ly, and feel free to reject this, but I made it so that if you open up the GUI fresh and select a save path, the raw data path will auto-populate with that path also. This just reduces the number of clicks from 2 to 1 if you're re-opening a project and have saved the outputs to the same folder as the inputs (which I had).

Let me know if you have any questions. I can confirm that with the latest IBL atlas ephys gui, and some data exported from spikeinterface (using a function that I will be adding there shortly...), I can open the results from this export func + script.

Thanks!

@petersaj
Copy link
Owner

petersaj commented Nov 7, 2024

Hi Jonah - this is great, thanks! Couple questions, I can make code suggestions depending on what you think:

Are the intermediate npy files useful, or would it be easier to have the export option call the python file directly and just be an "export to IBL format" function?

I tend to have raw and processed images in separate folders, so ideally wouldn't keep raw path auto-population. But when opening up a fresh GUI to look at previously processed images, it shouldn't actually need a raw data path - did you have cases where for some reason you needed the raw path populated after you'd finished processing? I'd think only if you didn't finish processing in the last session, which might be rare.

Tangent: I had been finding that linear fits between the CCF and histology usually weren't good enough, so I made changes to allow for non-linear fits in this branch: https://github.com/petersaj/AP_histology/tree/nonlin. This requires more control points, but in the end gives a better match. If you have time, do you want to see if that works well for you and plays well with your IBL conversion code, and then I can pull both your changes and the nonlinear changes together?

@jonahpearl
Copy link
Author

jonahpearl commented Nov 7, 2024

Are the intermediate npy files useful

I imagine you could use them for brainglobe, since that's in CCF I think? I can give that a try.

Re auto invoking the script: It needs a specific ibl package that certainly won't be in people's default python install, so there would be weird conda trickery required, and I'd rather keep matlab and python separate. If we can figure out a way to replicate the python functionality inside matlab, I'm all for it. It's probably just arithmetic and index shuffling right..?

Re raw file path: the code was throwing an error if I populated the processed path but not the raw path; it may have been benign. Iirc the core issue was that the path is initialized to sth other than a string, so if we fixed that instead it might eliminate the stray error.

Re non linear: my instinct is to offer the choice between linear and non linear fits, happy to try out any of those changes on my data.

@jonahpearl
Copy link
Author

the code was throwing an error if I populated the processed path but not the raw path;

Ok this was wrong; what's really happening is that if you open and close the file selection gui without selecting anything, MATLAB was returning 0, so I just sanitized that back to a char.

Re auto invoking the script: I checked the IBL function, it is indeed just arithmetic, but it's sort of spread out through a class and reverse-engineering it would be a pain. Plus if they ever change their coord system you'd have to re-reverse engineer it...so I think it's best just to use the function they provide.

I'll give the non linear a try soon

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