Skip to content

Integration with NWB #12

Open
Open

Description

@samuelgarcia

@lfrank @bendichter

You both mention NWB backend for handling probe geometry description.
I have NOT studied then yet.
I will.

Are theses two codes linked somehow ?

https://github.com/NovelaNeuro/ndx-franklab-novela
this seams to be a description of in house data management for recordings that also include probes description (with multi shank)

https://github.com/catalystneuro/ndx-spatial-coordinates/blob/main/src/spec/create_extension_spec.py
being unfamilir wuth nwb I get the purposed on this, could you explain more ?

Would be a way to define some kind of offcial to describe probes in NWB.
Maybe my question is naive because I am not aware of what have already been done.

Activity

  1. samuelgarcia commented on Dec 2, 2020

    @samuelgarcia
    MemberAuthor

    About the ndx-franklab-novela I will use lots of fields propose by this project.

  2. bendichter commented on Dec 2, 2020

    @bendichter
    Contributor

    ndx-spatial-coordinates is a work-in-progress. It's a project with the Allen Institute that encompasses several related topics: probe configuration, anatomical atlas, and spatial transformations. We have started thinking about how to define objects in 2 and 3 d, so I thought it might be relevant for you. It's still a work-in-progress though, is likely to change, and currently has no documentation.

  3. samuelgarcia commented on Dec 2, 2020

    @samuelgarcia
    MemberAuthor

    Is it with Luke Campagnola ?

  4. samuelgarcia commented on Jan 11, 2021

    @samuelgarcia
    MemberAuthor

    Hi @bendichter.
    I have release today version 0.1.0
    The actual package contain a "read_nwb(...)" function which is empty at the moment.
    When nwb format will have something about the spatial probe description it would be cool to implement this function as a proof of concept to test prointerface API.

  5. CodyCBakerPhD commented on Jul 27, 2022

    @CodyCBakerPhD

    @D1o0g9s will be helping with this task

    Some pseudo-code design for reading NWB without the use of the extension @D1o0g9s is putting together, as well as a modular step-by-step bite-size tasklist

    1

    read stuff in probeinterface.io

    def read_from_nwb(nwbfile_path : str) -> Probe:  # or w/e name you want
    with NWBHDF5IO(file, "r") as io:
         nwbfile = io.read()
    
        # figure out num_dims and num_contaacts,
        
        shape = nwbfile.electrodes.get("shape")
        # shape_params only necessary if shape is not None
    
        probe_object = Probe(ndim = num_dims, si_units="um")
    
        poisitions_2d = np.empty(shape=(num_contacts, num_dims))
        for j, column_name in enumerate(["rel_x", "rel_y", "rel_z"]):
               poisitions_2d[, j] = nwbfile.electrodes[column_name]
    
        probe_object.set_contacts(positioned_2d, shapes=shape, shape_params=shape_params)
        
        return probe_object

    2

    In neuroconv.tools.probeinterface

    def add_probe_info(nwbfile : NWBFile):
        # map all probeinterface.Probe fields to electrode columns + use the ndx-probe extension for nicely describing probe geometry in the new Device object
    
    def write_probe(probe: Probe, nwbfile_path : str, metadata : dict, overwrite : bool = False):
        with NWBHDF5IO(path=nwbfile_path, mode="w" if overwrite else "r+") as io:
            nwbfile = make_nwbfile_from_metadata(metadata) if overwrite else io.read() # this is typical basic neuroconv metadata strcture, mainly for session_start_time
            add_probe_info(nwbfile=nwbfile)
            io.write(nwbfile)

    3

    read more complete information (if available) in probeinterface.io

    def read_from_nwb():  # or w/e name you want
    with NWBHDF5IO(file, "r") as io:
         nwbfile = io.read()
    
         # all the previous stuff from #1
    
        # then read in all that stuff was that newly written through the use of # 2
        # goal being to be capable of a full roundtrip without any loss in information when using neuroconv.tools.probeinterface.write_probe to write a nwbfile, then using probe=read_from_nwb(nwbfile_path) to read it back
  6. alejoe91 commented on Mar 24, 2026

    @alejoe91
    Member

    https://github.com/SpikeInterface/ndx-probeinterface

    The ndx-probeinterface can directly convert probeinterfce objects to NWB devices

  7. CodyCBakerPhD commented on Mar 24, 2026

    @CodyCBakerPhD

    @alejoe91 Asking for a separate reason now (BEP032 related)

    Is there a way for ProbeInterface to 'read' a Probe object from an NWB file?

  8. alejoe91 commented on Mar 24, 2026

    @alejoe91
    Member

    Hi @CodyCBakerPhD!

    Saved by ndx-probeinterface?

  9. CodyCBakerPhD commented on Mar 24, 2026

    @CodyCBakerPhD

    @alejoe91 Let's say 'yes', primarily expecting that to have been done via NeuroConv

  10. alejoe91 commented on Mar 24, 2026

    @alejoe91
    Member

    I don't think NeuroConv is currently using ndx-probeinterface though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions