vesicle-rf Functions¶
-
packages.vesiclerf.
vesiclerf_example
(zStart, zStop)¶ Driver function to demonstrate vesicle-rf functionality for new users.
Inputs
None. Driver script is self-contained.Outputs
None. Driver script is self-contained.Notes
Using the default parameters, small edge synapses may be missed in this reference implementation. As a prerequisite to running this script, you should have a trained classifier (provided in the git repo) called bmvc_classifier - you can use a different classifier if desired
-
packages.vesiclerf.
vesiclerf_train
(outputFile)¶ Function to train a RF classifier on a fixed region of interest (AC4)
Inputs
- outputFile: (string)
- Location of output file containing classifier, saved as a matlab file in a variable named ‘classifier’
Outputs
No explicit outputs. Output file is saved to disk rather than output as a variable to allow for downstream integration with LONI.Notes
Currently training region is hardcoded, but can be adjusted as needed by getting new ‘*DataTrain’.
-
packages.vesiclerf.
vesiclerf_probs
(edata, vesicles, membrane, classifier_file, padX, padY, padZ, outFile)¶ Function to compute classifier probabilities on an input data cube.
Inputs
- edata: (string)
- Location of mat file containing uint8 EM data RAMONVolume, saved as ‘cube’.
- vesicles: (string)
- Location of mat file containing uint32 vesicle data RAMONVolume, saved as ‘cube’.
- membrane: (string)
- Location of mat file containing float32 membrane data RAMONVolume, saved as ‘cube’.
- classifier_file: (string)
- Location of classifier mat file, created during training. Classifier is saved as the variable ‘classifier’.
- padX (uint)
- Number representing value to crop the output volume in the x dimension.
- padY (uint)
- Number representing value to crop the output volume in the y dimension.
- padZ (uint)
- Number representing value to crop the output volume in the z dimension.
- outFile (string)
- Location of output file, saved as a matfile containing a RAMONVolume named ‘cube’. Contains result of applying classifier to input data. Output cube is a probability map (float32).
Outputs
No explicit outputs. Output file is saved to disk rather than output as a variable to allow for downstream integration with LONI.Notes
Optionally, input data may be passed in as variables from the current workspace, rather than through files.
-
packages.vesiclerf.
vesiclerf_object
(prob, threshold, minSize2D, maxSize2D, minSize3D, minSlice, doEdgeCrop, dynamicFlag, outFile, padX, padY, padZ)¶ vesiclerf_object: this function takes in a probability cube and parameters and outputs objects (e.g. synapses)
Inputs
- prob: (string)
- Location of mat file containing a RAMONVolume named cube. Each value corresponds to the probability that the voxel belongs to the synapse class
- threshold: (float)
- Threshold used in converting probability cube to a binary mask of potential synapse locations.
- minSize2D: (uint)
- Minimum size threshold for synapse objects in 2D.
- maxSize2D: (uint)
- Maximum size threshold for synapse objects in 2D.
- minSize3D: (uint)
- Minimum size threshold for synapse objects in 3D.
- minSlice: (uint)
- Minimum slice persistence in 3D for a synapse to count.
- doEdgeCrop: (logical)
- 0: do not crop cube. 1: remove all synapses touching the cube boundary.
- dynamicFlag: (logical)
- 0: do not adjust threshold. 1: adjust probability threshold to account for variable intensities (useful for large deployments)
- outFile: (string)
- String specifying the full path and file name for the output of the object detection algorithm.
- padX (uint)
- Number representing value to crop the output volume in the x dimension.
- padY (uint)
- Number representing value to crop the output volume in the y dimension.
- padZ (uint)
- Number representing value to crop the output volume in the z dimension.
Outputs
No explicit outputs. Output file is saved to disk rather than output as a variable to allow for downstream integration with LONI.
-
packages.vesiclerf.
vesiclerf_feats
(em, idxToTest, vesicles)¶ Function to compute features for synapse detection.
Inputs
- em: (uint8)
- Matrix containing the raw EM dataset of interest.
- idxToTest: (uint32)
- Vector containing a list of linear indices to use in feature extraction and downstream classification.
- vesicles: (string)
- Location of mat file containing a RAMONVolume named cube. The cube contains a binary mask indicating locations of putative neurotransmitter-containing vesicles.
Outputs
- xt: (float)
- Matrix (NxD) containing features for N idxToTest datapoints and D features.
Now with Integral Images
-
packages.vesicledetector.
vesicledetect_quick
(RAMONVol, template, annoId, neighborhood_size, neighbor_dist, thresh, data_set, padX, padY, padZ, outFile)¶ Function to identify neurotransmitter-containing vesicles using a template
Inputs
- RAMONVol: (string)
- template: (string)
- neighborhood_size: (uint)
- Size of neighborhood for algorithm
- neighborhood_dist: (uint)
- Distance used in suppressing isolated detections
- thresh: (uint)
- Threshold used for determining whether a correlation response is strong enough to return a vesicle at that location
- data_set: (uint)
- Dataset parameters (used to convert to raw image size values). 0: kasthuri11, 1: bock11
- padX (uint)
- Number representing value to crop the output volume in the x dimension.
- padY (uint)
- Number representing value to crop the output volume in the y dimension.
- padZ (uint)
- Number representing value to crop the output volume in the z dimension.
- outFile: (string)
- String specifying the full path and file name for the output of the vesicle detection algorithm (RAMONVolume saved to disk).
Outputs
No explicit outputs. Output file is saved to disk rather than output as a variable to allow for downstream integration with LONI.Notes
Test call vesicle_detect_quick(im,’~/code/vesicle/data/vesicle_templates_kasthuri11cc.mat’,1, 3,120,1.25,0,50,50,2,’testv.mat’) Load data volume
vesicle-rf Utilities¶
-
packages.vesiclerf.tools.
create_labels_pixel
(sData, pixIdx, pad)¶ Function to create labels based on truth data
Inputs
- sData: (uint32)
- Matrix containing truth labels for object class of interest.
- pixIdx: (uint)
- Pixels to evaluate (determined based on upstream processing)
- pad: (uint, 1x3)
- Pad region for sData matrix (keep out region)
Outputs
- Y (uint32)
- Labels to use in classification
-
packages.vesiclerf.tools.
minSliceEnforce
(anno, minSlice)¶ Function to remove objects that do not persist across multiple slices
Inputs
- anno (uint32)
- Matrix containing annotation objects
- minSlice: (uint)
- Minimum number of slices required for persistence
Outputs
- anno (uint32)
- Filtered anno matrix with spurrious detections removed.
nslices = 1 will have no effect
-
packages.vesiclerf.tools.
pr_evaluate_full
(detectVol, truthVol, metricsFile)¶ Function to compute a precision recall curve across a wide range of parameters
Inputs
- detectVol: (string)
- Location of mat file containing detected objects in a RAMONVolume named cube.
- truthVol: (string)
- Location of mat file containing truth objects in a RAMONVolume named cube.
- metricsFile: (string)
- Location of mat file containing metrics data from conducting the sweep.
Outputs
No explicit outputs. Output file is saved to disk rather than output as a variable to allow for downstream integration with LONI.** Notes**
This function grid searches the parameter space with no optimizations for clarity. pr_object provides an alternative, simpler sweep.
vesicle-cnn Functions¶
This is documented in the tutorials section and in the vesicle-cnn readme. Additional information coming soon.