deepcinac.cinac_structures

Module Contents

Classes

CinacMovie

Helper class that provides a standard way to create an ABC using

CinacDataMovie

Take the movie as a 2d array directly

CinacTiffMovie

Helper class that provides a standard way to create an ABC using

CinacFileReaderMovie

Helper class that provides a standard way to create an ABC using

CinacSplitedTiffMovie

Used if tiff movie has been splitted as as many tiff files as frames in the movie

CinacSplitedNpyMovie

Used if tiff movie has been splitted as as many tiff files as frames in the movie

CinacRecording

Functions

get_cinac_movie_from_cinac_file_reader(cinac_file_reader)

param cinac_file_reader

CinacFileReader instance

create_cinac_recording_from_cinac_file_segment(...)

param identifier

cinac_recording identifier

class deepcinac.cinac_structures.CinacMovie

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract get_frames_section(frames, minx, maxx, miny, maxy)
get_dimensions()

Get x and y dimensions of the movie Returns: a 1d array of integers

get_n_frames()

The number of frames in the movie Returns: integer

abstract get_full_movie(normalized)

Full movie, if available a 3d array n_frames x len_y x len_x :param normalized: bool, if True return normalized movie, False original movie if available

Returns:

class deepcinac.cinac_structures.CinacDataMovie(movie, already_normalized=False)

Bases: CinacMovie

Take the movie as a 2d array directly

get_frames_section(frames, minx, maxx, miny, maxy)
get_full_movie(normalized)

Full movie, if available a 3d array n_frames x len_y x len_x :param normalized: bool, if True return normalized movie, False original movie if available

Returns:

class deepcinac.cinac_structures.CinacTiffMovie(tiff_file_name=None, tiff_movie=None)

Bases: CinacMovie

Helper class that provides a standard way to create an ABC using inheritance.

get_frames_section(frames, minx, maxx, miny, maxy)
get_full_movie(normalized)

Full movie, if available a 3d array n_frames x len_y x len_x :param normalized: bool, if True return normalized movie, False original movie if available

Returns:

class deepcinac.cinac_structures.CinacFileReaderMovie(cinac_file_reader, segment)

Bases: CinacMovie

Helper class that provides a standard way to create an ABC using inheritance.

get_frames_section(frames, minx, maxx, miny, maxy)
get_full_movie(normalized)

Full movie, if available a 3d array n_frames x len_y x len_x :param normalized: bool, if True return normalized movie, False original movie if available

Returns:

class deepcinac.cinac_structures.CinacSplitedTiffMovie(identifier, tiffs_dirname, already_normalized=False, tiff_file_name=None, tiff_movie=None)

Bases: CinacMovie

Used if tiff movie has been splitted as as many tiff files as frames in the movie

get_frames_section(frames_indices, minx, maxx, miny, maxy)

get section of given frames from the calcium imaging movie :param frames_indices: numpy array of integers, representing the frame’s indices to select :param minx: integer, min x coordinate :param maxx: integer, max x coordinate :param miny: integer, min y coordinate :param maxy: integer, max y coordinate

Returns:

get_full_movie(normalized)

Full movie, if available a 3d array n_frames x len_y x len_x :param normalized: bool, if True return normalized movie, False original movie if available

Returns:

class deepcinac.cinac_structures.CinacSplitedNpyMovie(identifier, tiffs_dirname, already_normalized=False, tiff_file_name=None, tiff_movie=None)

Bases: CinacMovie

Used if tiff movie has been splitted as as many tiff files as frames in the movie

get_frames_section(frames_indices, minx, maxx, miny, maxy)

get section of given frames from the calcium imaging movie :param frames_indices: numpy array of integers, representing the frame’s indices to select :param minx: integer, min x coordinate :param maxx: integer, max x coordinate :param miny: integer, min y coordinate :param maxy: integer, max y coordinate

Returns:

get_full_movie(normalized)

Full movie, if available a 3d array n_frames x len_y x len_x :param normalized: bool, if True return normalized movie, False original movie if available

Returns:

deepcinac.cinac_structures.get_cinac_movie_from_cinac_file_reader(cinac_file_reader)
Parameters

cinac_file_reader – CinacFileReader instance

Returns:

deepcinac.cinac_structures.create_cinac_recording_from_cinac_file_segment(identifier, cinac_file_reader, segment)
Parameters
  • identifier – cinac_recording identifier

  • cinac_file_reader – CinacFileReaderInstance

  • cinac_movie – CinacMovie instance

  • segment – tuple of 3 int (cell, first_frame, last_frame

Returns:

class deepcinac.cinac_structures.CinacRecording(identifier)
_build_traces()
get_raw_traces(normalized)
Parameters

normalized – if True, get the raw_traces normalized

Returns:

get_smooth_traces(normalized)
Parameters

normalized – if True, get the raw_traces normalized

Returns:

set_movie(cinac_movie)

Set the instance of CinacMovie, that will be used to get the frames given to the network :param cinac_movie:

Returns:

set_rois_from_suite_2p(is_cell_file_name, stat_file_name)
Parameters
  • is_cell_file_name – path and file_name of the file iscell.npy produce by suite2p segmentation process

  • stat_file_name – path and file_name of the file stat.npy produce by suite2p segmentation process

Returns:

set_rois_2d_array(coord, from_matlab)
Parameters
  • coord – numpy array of 2d, first dimension of length 2 (x and y) and 2nd dimension of length the number of

  • integers (cells. Could also be a list of lists or tuples of 2) –

  • from_matlab – Indicate if the data has been computed by matlab, then 1 will be removed to the coordinates

  • zero. (so it starts at) –

Returns:

set_rois_from_nwb(nwb_data, name_module, name_segmentation, name_seg_plane)
Parameters
  • nwb_data – nwb object instance

  • name_module – Name of the module to find segmentation. Will be used this way: nwb_data.modules[name_module] Ex: name_module = ‘ophys’

  • name_segmentation – Name of the segmentation in which find the plane segmentation. Used this way:get_plane_segmentation(name_segmentation) Ex: name_segmentation = ‘segmentation_suite2p’

  • name_seg_plane – Name of the segmentation plane in which to find the ROIs data

  • way (Used this) – mod[name_segmentation]get_plane_segmentation(name_seq_plane) Ex: name_segmentation = ‘my_plane_seg’

Returns:

set_rois_using_pixel_mask(pixel_masks)
Parameters

pixel_masks – list of list of 2 integers representing for each cell all the pixels that belongs to the cell

Returns:

get_n_frames()

Return the number of frames in the movie Returns:

get_n_cells()
get_source_profile_frames(frames_indices, coords)

Return frames section based on the indices of the frames and the coordinates of the corners of the section :param frames_indices: array of integers :param coords: tuple of 4 integers: (minx, maxx, miny, maxy)

Returns: A numpy array of dimensions len(frames_indices) * (maxy - miny + 1) * (maxx - minx + 1)