NeuroPAL_ID File Handlers

Back to overview

Helper Classes

HDF5
class DataHandling.Helpers.h5

HDMF Summary of this class goes here Detailed explanation goes here

Method Summary
load_tracks(filepath)
Nikon
class DataHandling.Helpers.nd2

ND2 Class for handling and extracting metadata and images from ND2 files.

Property Summary
channel_keys

Keys used to identify channel metadata

key_map
name_substr

Base substring used to identify channel names globally

Method Summary
static autosort(channels)
static channels_from_file(file)
static get_channel_names(reader)
static get_channels(reader)
static get_dimensions(file)
static get_plane(file, varargin)

GET_PLANE Extract a specific plane or slice from the ND2 file based on the given coordinates.

Parameters:
  • x (varargin - Input parser options for)

  • y

  • z

  • c

  • dimensions. (t)

Returns:

obj - Multidimensional array containing image planes.

static get_ttl(file)
static get_ttl_data(file)
  1. Determine number of frames in the series

static get_ttl_keys(file, target)
static open(file)

OPEN Open an ND2 file, returning a reader object or image data and metadata.

Parameters:

file. (file - Path to the ND2)

Returns:

obj - Reader object or image data depending on lazy loading status. metadata - Struct containing metadata information for the file.

static to_npal(file)

CONVERTND2 Convert an ND2 file to NeuroPAL format.

nd2_file = the ND2 file to convert np_file = the NeuroPAL format file

NeurodataWithoutBorders
class DataHandling.Helpers.nwb
Method Summary
static get_channel_names(f, module)
static get_plane(varargin)
static load_tracks(filepath)
static open(file)
static search(file, module)

to be merged from loader branch

static to_npal(file, is_video)

CONVERTNWB Convert an NWB file to NeuroPAL format.

nwb_file = the NWB file to convert np_file = the NeuroPAL format file

static volume_path(new_path)
static write_data(np_file, data_pipe, dims)
NeuroPAL
class DataHandling.Helpers.npal

NPAL Summary of this class goes here Detailed explanation goes here

Method Summary
static create_neurons(varargin)
Java
class DataHandling.Helpers.java

Class java - Handles conversion of Java hashtable keys and values into MATLAB structures and manages string validity based on specified character constraints.

Property Summary
max_characters

Maximum number of characters allowed for valid strings.

Method Summary
static parse_hashtable(table)

Converts a Java hashtable into a MATLAB structure with valid field names.

Parameters:

table – A Java hashtable object containing key-value pairs.

Returns:

A MATLAB struct where keys are converted to valid MATLAB field names.

Return type:

obj

static search_key(metadata, query)
static to_valid(raw_str)

Converts an input string to a valid MATLAB field name by replacing or truncating characters.

Parameters:

raw_str – Original string to be validated and formatted.

Returns:

Modified string that meets MATLAB field name requirements.

Return type:

valid_str

static value_to_string(val)

Convert a Java-based metadata value to a MATLAB string

Generic NeuroPALImage

class DataHandling.NeuroPALImage

NEUROPALIMAGE Convert various image formats to a NeuroPAL format.

NeuroPAL files contain 4 variable:

data = the image data (x,y,z,c) info = the image information

scale = pixel scale in microns (x,y,z) RGBW = the (R,G,B,W) color channel indices (nan = no data) GFP = the GFP color channel index(s) (can be empty) DIC = the DIC channel index (can be empty) gamma = the gamma correction for the image

prefs = the user preferences

RGBW = the (R,G,B,W) color channel indices (nan = no data) GFP = the GFP color channel index(s) (can be empty) DIC = the DIC channel index (can be empty) gamma = the gamma correction for the image rotate.horizontal = rotate horizontal? rotate.vertical = rotate vertical?

worm = the worm information
body = ‘Whole Worm’, ‘Head’, ‘Midbody’, ‘Anterior Midbody’.

‘Central Midbody’, ‘Posterior Midbody’, or ‘Tail’

age = ‘Adult’, ‘L4’, L3’, ‘L2, ‘L1’, or ‘3-Fold’ sex = ‘XX’ or ‘XO’ strain = strain name notes = experimental notes

mp = matching pursuit (neuron detection) parameters neurons = the neurons in the image

Method Summary
static open(file)

OPEN Open an image in NeuroPAL format.

Input:

file = the NeuroPAL format filename

Output:

data = the image data info = the image information prefs = the user preferences worm = the worm information mp = matching pursuit (neuron detection) parameters neurons = the neurons in the image

np_file = the NeuroPAL image file id_file = the NeuroPAL ID file

Data Handling Module

DataHandling.imreadAny(filename)

IMREADANY Read in any image format (all purpose reader).

[IMAGE, METADATA] = IMREADANY(FILENAME)

Input: filename - the filename of the ND2 image

Outputs: image - the image, a struct with fields:

pixels = the number of pixels as (x,y,z) scale = the pixel scale, in meters, as (x,y,z) channels = the names of the channels colors = the color for each channel as (R,G,B) dicChannel = the DIC channel number lasers = the laser wavelength for each channel emissions = the emssion band for each channel as (min,max) data = the image data as (x,y,z,channel)

metadata - the meta data, a struct with fields:

keys = the meta data keys (the names for the meta data) values = the meta data values (the values for the meta data) hashtable = a Java Hashtable of keys and their values

DataHandling.imreadCZI(filename)

IMREADCZI Read in a Zeiss CZI image.

[IMAGE, METADATA] = IMREADCZI(FILENAME)

Input: filename - the filename of the CZI image

Outputs: image - the image, a struct with fields:

pixels = the number of pixels as (x,y,z) scale = the pixel scale, in meters, as (x,y,z) channels = the names of the channels colors = the color for each channel as (R,G,B) dicChannel = the DIC channel number lasers = the laser wavelength for each channel emissions = the emssion band for each channel as (min,max) data = the image data as (x,y,z,channel)

metadata - the meta data, a struct with fields:

keys = the meta data keys (the names for the meta data) values = the meta data values (the values for the meta data) hashtable = a Java Hashtable of keys and their values

DataHandling.imreadLif(filename)

IMREADANY Read .lif format (all purpose reader).

[IMAGE, METADATA] = IMREADANY(FILENAME)

Input: filename - the filename of the lif image idx - index of the series (0 to n-1)

Outputs: image - the image, a struct with fields:

pixels = the number of pixels as (x,y,z) scale = the pixel scale, in meters, as (x,y,z) channels = the names of the channels colors = the color for each channel as (R,G,B) dicChannel = the DIC channel number lasers = the laser wavelength for each channel emissions = the emssion band for each channel as (min,max) data = the image data as (x,y,z,channel)

metadata - the meta data, a struct with fields:

keys = the meta data keys (the names for the meta data) values = the meta data values (the values for the meta data) hashtable = a Java Hashtable of keys and their values

DataHandling.imreadND2(filename)

IMREADND2 Read in a Nikon ND2 image.

[IMAGE, METADATA] = IMREADCZI(FILENAME)

Input: filename - the filename of the ND2 image

Outputs: image - the image, a struct with fields:

pixels = the number of pixels as (x,y,z) scale = the pixel scale, in meters, as (x,y,z) channels = the names of the channels colors = the color for each channel as (R,G,B) dicChannel = the DIC channel number lasers = the laser wavelength for each channel emissions = the emssion band for each channel as (min,max) data = the image data as (x,y,z,channel)

metadata - the meta data, a struct with fields:

keys = the meta data keys (the names for the meta data) values = the meta data values (the values for the meta data) hashtable = a Java Hashtable of keys and their values

DataHandling.imreadVlab(filename)

IMREADVLAB Read in VLab image data from a given folder.

[IMAGE, METADATA] = IMREADVLAB(FILENAME)

Input: folder - the folder containing the data

Outputs: image - the image, a struct with fields:

pixels = the number of pixels as (x,y,z) scale = the pixel scale, in microns, as (x,y,z) channels = the names of the channels colors = the color for each channel as (R,G,B) dicChannel = the DIC channel number lasers = the laser wavelength for each channel emissions = the emsspyeion band for each channel as (min,max) data = the image data as (x,y,z,channel)

metadata - the meta data, a struct with fields:

keys = the meta data keys (the names for the meta data) values = the meta data values (the values for the meta data) hashtable = a Java Hashtable of keys and their values

class DataHandling.NeuroPALImage

NEUROPALIMAGE Convert various image formats to a NeuroPAL format.

NeuroPAL files contain 4 variable:

data = the image data (x,y,z,c) info = the image information

scale = pixel scale in microns (x,y,z) RGBW = the (R,G,B,W) color channel indices (nan = no data) GFP = the GFP color channel index(s) (can be empty) DIC = the DIC channel index (can be empty) gamma = the gamma correction for the image

prefs = the user preferences

RGBW = the (R,G,B,W) color channel indices (nan = no data) GFP = the GFP color channel index(s) (can be empty) DIC = the DIC channel index (can be empty) gamma = the gamma correction for the image rotate.horizontal = rotate horizontal? rotate.vertical = rotate vertical?

worm = the worm information
body = ‘Whole Worm’, ‘Head’, ‘Midbody’, ‘Anterior Midbody’.

‘Central Midbody’, ‘Posterior Midbody’, or ‘Tail’

age = ‘Adult’, ‘L4’, L3’, ‘L2, ‘L1’, or ‘3-Fold’ sex = ‘XX’ or ‘XO’ strain = strain name notes = experimental notes

mp = matching pursuit (neuron detection) parameters neurons = the neurons in the image

Method Summary
static open(file)

OPEN Open an image in NeuroPAL format.

Input:

file = the NeuroPAL format filename

Output:

data = the image data info = the image information prefs = the user preferences worm = the worm information mp = matching pursuit (neuron detection) parameters neurons = the neurons in the image

np_file = the NeuroPAL image file id_file = the NeuroPAL ID file

class DataHandling.PNGViewer

PNGVIEWER View PNG files.

Method Summary
static show(file, name)

SHOW Show the PNG file.

DataHandling.readAnnoH5(path)
DataHandling.readStimFile(path)
DataHandling.readTrackmate(file)
DataHandling.sysOpenPDF(fileName)

OPENPDF Opens a PDF file in the appropriate viewer/editor.

class DataHandling.writeNWB

Functions responsible for handling our dynamic GUI solutions.

Method Summary
static create_channels(optical_table)

Populate channel data

static create_device(name, description, manufacturer)
static create_file(ctx)
static create_module(module, ctx)
static create_segmentation(preset, ctx)
static create_traces(ctx)
static create_volume(preset, module, ctx)
static write_order(app, path, progress)

Full-shot NWB save routine

DataHandling.writeTrackMate(video_info, video_neurons, output_file, figure)