Package: deepd3
DeepD3We provide DeepD3, a framework for thedetection ofdendritic spines anddendrites.With DeepD3, you are able totrain a deep neural network for dendritic spine and dendrite segmentationuse pre-trained DeepD3 networks for inferencebuild 2D and 3D ROIsexport results to your favourite biomedical image analysis platformuse command-line or graphical user interfacesHow to install and run DeepD3DeepD3 is written in Python. First, please download and install any Python-containing distribution, such asAnaconda. We recommend Python 3.7 and more recent version.Then, installing DeepD3 is as easy as follows:pip install deepd3Now, you have access to almost all the DeepD3 functionalities.If you want to use the DeepD3 Neural Network inference mode, please installTensorflowusing either of the following commands:# With CPU support only
conda install tensorflow

# With additional GPU support
conda install tensorflow-gpuIf you would like to access DeepD3-GUIs, use the following two shortcuts in your favourite shell:# Opening the segmentation and ROI building GUI
deepd3-inference

# Opening the training utilities
deepd3-trainingModel zooWe provide a comprehensive training dataset on zenodo and theDeepD3 Website:DeepD3_8F.h5- 8 base filters, original resolutionDeepD3_16F.h5- 16 base filters, original resolutionDeepD3_32F.h5- 32 base filters, original resolutionDeepD3_8F_94nm.h5- 8 base filters, resized to 94 nm xy resolutionDeepD3_16F_94nm.h5- 16 base filters, resized to 94 nm xy resolutionDeepD3_32F_94nm.h5- 32 base filters, resized to 94 nm xy resolutionBrief description:Full (32F) DeepD3 model trained on 94 nm (fixed) or a blend of resolutions (free)Medium (16F) DeepD3 model trained on 94 nm (fixed) or a blend of resolutions (free)Tiny (8F) DeepD3 mode trained on 94 nm (fixed) or a blend of resolutions (free)WorkflowTrain DeepD3 on your own datasetUsedeepd3-trainingto start the GUI for generating training sets.For each of your training set, please provideThe original stack as e.g. TIF filesThe spine annotations (binary labels) as TIF or MASK files (the latter frompipra)The dendrite annotations as SWC file (only tested for SWC-files generated byNeuTube)Create training dataClick on the button "Create training data". For each of your stacks, import the stack, the spine annotation and the dendrite annotation file.
If you dendrite annotation is a SWC file, it will create a 3D reconstruction of the SWC file, which will be stored for later use. If you reload the SWC, it will ask you if you want to keep the 3D reconstruction.After importing all files, enter the metadata (resolution in x, y and z) and determine the region of interest using the bounding box and the sliders.
Shortcuts areBfor current plane isz beginandEforz end. You may enable or disable the cropping to the bounding box. If you are happy, save this region asd3data-file.View training dataClick on the button "View training data" to re-visit anyd3datafiles. You also are able to see and potentially manipulate the metadata associated thed3datafile.Arrange training dataFor training, you need to create ad3set. This is an assembly ofd3datafiles. Click on the button "Arrange training data". Then, simply load all relevant data using the "Add data to set" button and select appropriated3datafiles. Clicking on "Create dataset" allows you to save your assembly asd3setfile.Actual trainingWe have prepared a Jupyter notebook in the folderexamples. Follow the instructions to train your own deep neural network for DeepD3 use.
For professionals, you also may utilize directly the files inmodelandtrainingto allow highly individualized training.
You only should ensure that your model allows arbitrary input and outputs two separate channels (dendrites and spines).InferenceOpen the inference mode usingdeepd3-inference. Load your stack of choice (we currently support TIF stacks) and specify the XY and Z dimensions. Next, you can segment dendrites and dendritic spines using a DeepD3 model fromthe model zooby clicking onAnalyze -> Segment dendrite and spines. Afterwards, you may clean the predictions by clicking onAnalyze -> Cleaning. Finally, you may build 2D or 3D ROIs using the respective functions inAnalyze. To test the 3D ROI building, double click in the stack to a region of interest. A window opens that allows you to play with the hyperparameters and segments 3D ROIs in real-time.All results can be exported to various file formats. For convenience, DeepD3 saves related data in its "proprietary" hdf5 file (that you can open using any hdf5 viewer/program/library). In particular, you may export the predictions as TIF files, the ROIs to ImageJ file format or a folder, the ROI map to a TIF file, or the ROI centroids to a file.Most functions can be assessed using a batch command script located indeepd3/inference/batch.py.How to citeDeepD3 is available as preprint soon.