caiman_loader.py
CaImAn
¶
Parse the CaImAn output file
Expecting the following objects
- dims:
- dview:
- estimates: Segmentations and traces
- mmap_file:
- params: Input parameters
- remove_very_bad_comps:
- skip_refinement:
- motion_correction: Motion correction shifts and summary images
Example
output_dir = '
/subject1/session0/caiman' loaded_dataset = caiman_loader.CaImAn(output_dir)
Attributes:
| Name | Type | Description |
|---|---|---|
alignment_channel |
hard-coded to 0 |
|
caiman_fp |
file path with all required files: "/motion_correction/reference_image", "/motion_correction/correlation_image", "/motion_correction/average_image", "/motion_correction/max_image", "/estimates/A", |
|
cnmf |
loaded caiman object; cm.source_extraction.cnmf.cnmf.load_CNMF(caiman_fp) |
|
creation_time |
file creation time |
|
curation_time |
file creation time |
|
extract_masks |
dict
|
function to extract masks |
h5f |
caiman_fp read as h5py file |
|
masks |
dict result of extract_masks |
|
motion_correction |
h5f "motion_correction" property |
|
params |
cnmf.params |
|
segmentation_channel |
hard-coded to 0 |
Source code in element_interface/caiman_loader.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
__init__(caiman_dir)
¶
Initialize CaImAn loader class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
caiman_dir |
str
|
string, absolute file path to CaIman directory |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
No CaImAn analysis output file found |
FileNotFoundError
|
No CaImAn analysis output found, missing required fields |
Source code in element_interface/caiman_loader.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
extract_masks()
¶
Extract masks from CaImAn object
Raises:
| Type | Description |
|---|---|
NotImplemented
|
Not yet implemented for 3D datasets |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Mask attributes - mask_id, mask_npix, mask_weights, mask_center_x, mask_center_y, mask_center_z, mask_xpix, mask_ypix, mask_zpix, inferred_trace, dff, spikes |
Source code in element_interface/caiman_loader.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |