|
Size: 20609
Comment:
|
← Revision 103 as of 2026-10-28 18:50:43 ⇥
Size: 21300
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 21: | Line 21: |
| This manual provides an end-to-end guide for using the tools available on FreeSurfer to reconstruct dissection photographs of brain slabs into a 3D-reconstruction for quantitative analysis. Reconstructions are done by registering photographs to a 3D reference like an MRI, a post-mortem surface scan, or an atlas. The guide touches on acquisition of surface scans prior to slabbing, preparing tissue slabs for gross photography, and how to preprocess photographs using the dissection_photo graphical user interface.<<BR>><<BR>> | This manual provides an end-to-end guide for using the tools available in FreeSurfer to reconstruct dissection photographs of brain slabs into a 3D reconstruction for quantitative analysis. Reconstructions are done by registering photographs to a 3D reference such as an MRI, a post-mortem surface scan, or an atlas. The guide covers acquiring surface scans prior to slabbing, preparing tissue slabs for gross photography, and preprocessing photographs using the dissection_photo graphical user interface.<<BR>><<BR>> |
| Line 26: | Line 26: |
| * the [[https://ftp.nmr.mgh.harvard.edu/pub/dist/lcnpublic/dist/dissection_photo_model/photo_imputation_unet.pth|reconstruction model]] downloaded, into `$FREESURFER_HOME/models` * A CUDA enabled graphics card is optional: segmentation and reconstruction are much faster with one. |
* the [[https://ftp.nmr.mgh.harvard.edu/pub/dist/lcnpublic/dist/dissection_photo_model/photo_imputation_unet.pth|reconstruction model]], downloaded into `$FREESURFER_HOME/models` * A CUDA-enabled graphics card is optional: segmentation and reconstruction are much faster with one. |
| Line 30: | Line 30: |
| 1. '''Acquire a 3D reference''' either a surface scan or an MRI. Without one, slabs are registered to an atlas. | 1. '''Acquire a 3D reference''': either a surface scan or an MRI. Without one, slabs are registered to an atlas. |
| Line 32: | Line 32: |
| 1. '''Preprocess the photos on the dissection photo GUI''' | 1. '''Preprocess the photos in the dissection photo GUI''' |
| Line 38: | Line 38: |
| A surface scan of the specimen, taken before it is slabbed after the cerebellum is sectioned. The full scanning protocol is available on its own page: '''[[PhotoTools Surface Scanning|Surface Scanning Protocol]]'''. Summary on key requirements of a reference mesh: |
A surface scan of the specimen is taken after the cerebellum has been sectioned off and before the specimen is slabbed. The full scanning protocol is available on its own page: '''[[PhotoTools Surface Scanning|Surface Scanning Protocol]]'''. Summary of the key requirements of a reference mesh: |
| Line 44: | Line 44: |
| * A watertight mesh, saved as `.stl`. Small holes in the initial point-cloud due to deep sulci are fine - these will be covered by the meshing process. | * A watertight mesh, saved as `.stl`. Small holes in the initial point cloud due to deep sulci are fine; these will be covered by the meshing process. |
| Line 54: | Line 54: |
| Use a high-contrast background that stands out in uniform contrast to the brain slabs, such as a solid black background. This will make slabs are easier to segment downstream. Using a complex background with color similar to your brain slabs, will lead to a more manual intervention such as having to manually trace contours, which is not only time-consuming but also non-reproducible.<<BR>> | Use a high-contrast background that stands out in uniform contrast to the brain slabs, such as a solid black background. This will make the slabs easier to segment downstream. Using a complex background with a color similar to your brain slabs will lead to more manual intervention, such as having to manually trace contours, which is not only time-consuming but also non-reproducible.<<BR>> |
| Line 56: | Line 56: |
| ||Difficult to segment low contrast background. ||Easy to segment high contrast background. || Additionally, all tissue block faces must be facing the same direction. All slices should be either from an anterior or a posterior view. Note if slabs are from the posterior view, an extra flag, '''--photos_of_posterior_side''' must be used for the final reconstruction command. When a single slice produces multiple tissue blocks, they should be placed as similar to the original anatomy as possible. For example, after acquiring slices from the frontal pole, the initial blocks corresponding to the temporal lobe will often be detached from the main block. The following figure shows a) Proper anatomical placement of tissue and, b) Tissue placed too far apart, which is not anatomically accurate. {{attachment:19_slab_placement.png||height="483",width="667"}} <<BR>>''Tissue slab placement a) Properly placed tissue b) Tissue placed in a non-anatomical manner.''<<BR>> Another example of difficult tissue placement can be the corpus callosum. In the following figure, we see a good example setup with high contrast for the background and good lighting. However, the placement of the corpus callosum on the rightmost slab is incorrect, which will negatively affect volumetric estimates of the third ventricle. |
||Low-contrast background: difficult to segment. ||High-contrast background: easy to segment. || Additionally, all tissue block faces must face the same direction: all slices should be photographed either from the anterior or from the posterior view. Note that if slabs are photographed from the posterior view, the extra flag '''--photos_of_posterior_side''' must be used in the final reconstruction command. When a single slice produces multiple tissue blocks, they should be placed as close to the original anatomy as possible. For example, after acquiring slices from the frontal pole, the initial blocks corresponding to the temporal lobe will often be detached from the main block. The following figure shows a) proper anatomical placement of tissue, and b) tissue placed too far apart, which is not anatomically accurate. {{attachment:19_slab_placement.png||height="483",width="667"}} <<BR>>''Tissue slab placement: a) properly placed tissue; b) tissue placed in a non-anatomical manner.''<<BR>> Another example of difficult tissue placement is the corpus callosum. The following figure shows a good setup, with a high-contrast background and good lighting. However, the placement of the corpus callosum on the rightmost slab is incorrect, which will negatively affect volumetric estimates of the third ventricle. |
| Line 74: | Line 69: |
| To calibrate pixel size, we will need landmarks with known distances in between them to be provided by the user. The minimum requirement is a ruler, which provides us with two discrete landmarks. This enables rough This method is preferable for legacy images that only have a ruler for reference. | To calibrate pixel size, the user needs to provide landmarks with known distances between them. The minimum requirement is a ruler, which provides two discrete landmarks. This enables rough pixel size correction. This method is preferable for legacy images that only have a ruler for reference. |
| Line 80: | Line 75: |
| A more effective setup involves four landmarks placed the corners of a rectangle of known dimensions. This enables us to correct for both pixel size and perspective. In the example below, we can easily tell that the 4 points marked on the grid define a rectangle of dimensions 170x200 mm. | A more effective setup uses four landmarks placed at the corners of a rectangle of known dimensions. This enables us to correct for both pixel size and perspective. In the example below, we can easily tell that the 4 points marked on the grid define a rectangle of 170 x 200 mm. |
| Line 84: | Line 79: |
| The optimal scenario is to have 4 points defined by fiducial markers with highly salient features. This enables our software to automatically recognize the fiducials, which minimizes human interaction, reducing time and maximizing reproducibility. We '''strongly''' recommend that you print these set fiducials and place them on the corners of the board. | The optimal scenario is to have 4 points defined by fiducial markers with highly salient features. This enables our software to recognize the fiducials automatically, which minimizes human interaction, reducing time and maximizing reproducibility. We '''strongly''' recommend that you print this set of fiducials and place them at the corners of the board. |
| Line 88: | Line 83: |
| '''''Tip''''': For best results, affix these fiducials to a small piece of rubber/wood/plastic that lifts them X mm above the board, where X is the thickness of your typical brain slice. Lifting the fiducial minimizes error due to the surface of the brain slice not being at the same distance as the plane of the board surface, but rather a few millimeters above it. | '''''Tip''''': For best results, affix the fiducials to a small piece of rubber, wood or plastic that lifts them X mm above the board, where X is the thickness of your typical brain slice. Lifting the fiducials minimizes the error caused by the surface of the brain slice not being in the same plane as the board, but a few millimeters above it. |
| Line 92: | Line 87: |
| The fiducial form the four corners of our corrected image; hence all tissue should be within the rectangle created from the four fiducial corners. The following image shows slab photos where the fiducials were not placed sufficiently apart. | The fiducials form the four corners of the corrected image; hence, all tissue should be within the rectangle formed by the four fiducials. The following image shows slab photos where the fiducials were not placed far enough apart. |
| Line 96: | Line 91: |
| By drawing a rectangle with all fiducial markers, it is clear that much of the tissue lies outside of the pixel-corrected region. | Drawing a rectangle through the four fiducial markers makes it clear that much of the tissue lies outside of the pixel-corrected region. |
| Line 100: | Line 95: |
| In summary, here is an example of what an optimal photographic setup would look like, including the uniform, high-contrast background and provided fiducials located at known distances, and consistent lighting on all slabs. | In summary, here is an example of an optimal photographic setup: a uniform, high-contrast background, the provided fiducials located at known distances, and consistent lighting on all slabs. |
| Line 104: | Line 99: |
| '''''Tip''''': It does not matter if slabs are not presented on a grid, as long as the distance between the fiducials is known. The software will draw digital rulers for your images later pixel-correction.<<BR>><<BR>> = Part 2: Prerprocessing Photographs with the Dissection Photo App = The dissection photo app has five principal windows for each subject: '''Add photos''', '''Correction''', '''Segmentation''', '''Connected components''' and '''Reconstruction'''. The step bar at the top of the window shows which step is being done, users can click any backtrack by clicking any of the previous steps at any time, alternatively the house icon to return to the Projects screen with a summary of all reconstructions done or in process. For each project work is saved as you go, so the can can be closed at any time to later pick up where you left off. Before continuing, make sure the development version of Freesurfer is properly sourced, you have downloaded the model weights, and have set the '''NNUNET_MODEL_DIR''' as an environment variable pointing to the segmentation model before continuing with the tutorial. To start the application use command '''dissection_photo_2''' <<BR>> |
'''''Tip''''': It does not matter if the slabs are not placed on a grid, as long as the distance between the fiducials is known. The software will draw digital rulers on your images during pixel correction.<<BR>><<BR>> = Part 2: Preprocessing Photographs with the Dissection Photo App = The dissection photo app has five principal windows for each subject: '''Add photos''', '''Correction''', '''Segmentation''', '''Connected components''' and '''Reconstruction'''. The step bar at the top of the window shows which step is being done. Users can backtrack by clicking any of the previous steps at any time, or click the house icon to return to the Projects screen with a summary of all reconstructions done or in process. For each project, work is saved as you go, so the app can be closed at any time and you can pick up later where you left off. Before continuing, make sure the development version of FreeSurfer is properly sourced, you have downloaded the model weights, and have set '''NNUNET_MODEL_DIR''' as an environment variable pointing to the segmentation model. To start the application, use the command '''dissection_photo_2'''. <<BR>> |
| Line 114: | Line 109: |
| {{attachment:ds2_00_projects.png||width="600"}} <<BR>> Projects Home screen | {{attachment:ds2_00_projects.png||width="560"}} <<BR>> ''Projects Home screen.'' |
| Line 119: | Line 114: |
| '''Tip''' For advanced users, the gear icon can be used to change which resources are used by the automatic segmentation model, covered in [[#Automatic_segmentation_settings|automatic segmentation settings]]. | '''Tip:''' For advanced users, the gear icon can be used to change which resources are used by the automatic segmentation model, covered in [[#Automatic_Segmentation_Settings|automatic segmentation settings]]. |
| Line 135: | Line 130: |
| 1. If you have or would like to create a calibration file to automate pixel correction, click on '''+ Add a calibration file (optional)''' and follow steps in [[#Making_a_calibration_file|Making a Calibration File]] and then [[#Prospective_Correction_.28Using_fiducial_markers_and_calibration_file.29|Prospective Correction]]. 1. Click '''Get Started.''' |
1. If you have or would like to create a calibration file to automate pixel correction, click on '''+ Add a calibration file (optional)''' and follow the steps in [[#Optional:_Making_a_calibration_file|Making a Calibration File]] and then [[#Prospective_Correction_.28Using_fiducial_markers_and_calibration_file.29|Prospective Correction]]. 1. Click '''Get started'''. ||<:> {{attachment:ds2_01_add_photos_empty.png||width="420"}} <<BR>> ''Add photos, before any photographs are chosen.'' ||<:> {{attachment:ds2_02_add_photos_populated.png||width="420"}} <<BR>> ''Photographs added, with the calibration file box expanded.'' || |
| Line 139: | Line 136: |
| This step only needs to be done once, as long as markers are not moved. For more information on proper usage refer to the ** section in this wiki page. 1. On the Add photos menu, click '''+ Add a calibration file (optional)''', to expand the calibration file box, and click on '''Create One''' under the Upload Calibration button. 1. On the next menu, If you have not printed out the fiducial markers they can be downloaded for printing out by clicking the '''Download Market Printout '''button. 1. Next, place markers at a known distance in a rectangle formation on the photography table. Be sure that opposite sides of the rectangle created by the fiducial markers is parallel - inacurate marker placement can lead to incorrect perspective correction. 1. Upload the photograph of the empty dissection table with just the markers present, and enter width and height of the fiducial box. 1. For each of the markers, click its centre and outer cirlce. Options to zoom, pan, redo/undo, can help fix mistakes and make the best calibration possible. 1. Click '''Save Calibration''' and save your calibration file in a easy to access location. '''Tip''' Because of slight lens distortion, the overlayed labels for the outer circle of the markers might not always align throughout the whole circunference. This is not an issue. ||{{attachment:v2_calibration_start.png||width="460"}} <<BR>> ''The Calibration screen, before a photo is chosen.''||{{attachment:v2_calibration.png||width="460"}} <<BR>> ''All four markers placed (centre and outer circle), with the distances between their centres entered.''|| |
This step only needs to be done once, as long as the markers are not moved. For more information on proper usage refer to the [[#Markers_for_pixel_and_perspective_corrections|Markers for pixel and perspective corrections]] section in this wiki page. 1. On the Add photos menu, click '''+ Add a calibration file (optional)''' to expand the calibration file box, and click on '''Create one''' under the Upload Calibration button. 1. On the next menu, if you have not printed out the fiducial markers, they can be downloaded for printing by clicking the '''Download Marker Printout''' button. 1. Next, place markers at a known distance in a rectangle formation on the photography table. Be sure that opposite sides of the rectangle created by the fiducial markers are parallel; inaccurate marker placement can lead to incorrect perspective correction. 1. Upload the photograph of the empty dissection table with just the markers present, and enter the width and height of the fiducial box. 1. For each of the markers, click its centre and outer circle. Options to zoom, pan, and redo/undo can help fix mistakes and make the best calibration possible. 1. Click '''Save Calibration''' and save your calibration file in an easy-to-access location. '''Tip:''' Because of slight lens distortion, the overlaid labels for the outer circle of the markers might not always align throughout the whole circumference. This is not an issue. {{attachment:ds2_03_calibration_photo.png||width="640"}} <<BR>> ''The photograph of the empty table with the four markers, uploaded.'' ||<:> {{attachment:ds2_04_calibration_zoomed.png||width="420"}} <<BR>> ''Zoomed in on one marker, before clicking.'' ||<:> {{attachment:ds2_05_calibration_clicks.png||width="420"}} <<BR>> ''The marker's centre and outer circle clicked.'' || |
| Line 153: | Line 152: |
| This step corrects all photograph to be at the same pixel size. Additionally can correct for perspective when using a calibration, or doing manual correction in 4-point mode. | This step corrects all photographs to be at the same pixel size. Additionally, it can correct for perspective when using a calibration file, or when doing manual correction in 4-point mode. |
| Line 159: | Line 158: |
||{{attachment:v2_correction_original.png||width="460"}} <<BR>> ''Original: the marker centres found in this photo.''||{{attachment:v2_correction_corrected.png||width="460"}} <<BR>> ''Corrected: the same photo at 0.1 mm per pixel, with rulers.''|| |
|
| Line 171: | Line 168: |
| ||<:> {{attachment:ds2_06_correction_ruler.png||width="420"}} <<BR>> ''2 Point mode: two points placed along a 150 mm ruler (Original).'' ||<:> {{attachment:ds2_07_correction_done.png||width="420"}} <<BR>> ''The corrected photo, with rulers (Corrected).'' || |
|
| Line 176: | Line 175: |
| ||{{attachment:v2_segmentation.png||width="460"}} <<BR>> ''An automatic mask (green) that missed part of each slab.''||{{attachment:v2_segmentation_fixed.png||width="460"}} <<BR>> ''The same mask after touching it up.''|| | ||<:> {{attachment:ds2_08_segmentation_mask_on.png||width="440"}} <<BR>> ''The automatic mask (green) shown over the slabs.'' ||<:> {{attachment:ds2_09_segmentation_mask_off.png||width="346"}} <<BR>> ''The mask hidden ('''Show mask''' off); the note at the top lists the masks not yet previewed.'' || |
| Line 187: | Line 186: |
| {{attachment:v2_settings.png||width="520"}} <<BR>> ''Automatic segmentation settings.'' | {{attachment:ds2_10_seg_settings.png||width="480"}} <<BR>> ''Automatic segmentation settings.'' |
| Line 197: | Line 196: |
| * In each photo, draw a box inside each slab (Ctrl + left drag), always in the same order: anterior to posterior, or posterior to anterior. The slab is coloured as soon as its box is drawn. | * In each photo, draw a box inside each slab (Ctrl + left drag), always in the same order: anterior to posterior, or posterior to anterior. The slab is colored as soon as its box is drawn. |
| Line 202: | Line 201: |
| ||{{attachment:v2_components.png||width="460"}} <<BR>> ''One box inside each slab; each slab is coloured.''||{{attachment:v2_components_saved.png||width="460"}} <<BR>> ''Saved: the photo gets a green tick in the strip.''|| | {{attachment:ds2_11_components_empty.png||width="420"}} <<BR>> ''Before any boxes are drawn.'' ||<:> {{attachment:ds2_12_components_good.png||width="420"}} <<BR>> ''One small box inside each slab; each slab is colored and the photo is saved.'' ||<:> {{attachment:ds2_13_components_bad.png||width="420"}} <<BR>> ''How '''NOT''' to draw boxes: they overlap each other and cover background.'' || |
| Line 209: | Line 210: |
| 1. '''Reference''': none (the MNI atlas), a surface mesh (`.stl`), an MRI scan, or both. See [[#Which reference should I use?|Which reference should I use?]] | 1. '''Reference''': none (the MNI atlas), a surface mesh (`.stl`), an MRI scan, or both. See [[#Which_reference_should_I_use.3F|Which reference should I use?]] |
| Line 215: | Line 216: |
| {{attachment:v2_reconstruction.png||width="700"}} <<BR>> ''The Reconstruction step, with the command that will be run.'' | {{attachment:ds2_14_reconstruction.png||width="640"}} <<BR>> ''A reconstruction running, with the command and its log.'' |
Photo Reconstruction Documentation
Contents
- Photo Reconstruction Documentation
- Part 1: Acquisition
- Part 2: Preprocessing Photographs with the Dissection Photo App
- Part 3: Downstream Tasks
Citation
If you use these tools in your analysis, please cite:
Gazula, H., Tregidgo, H.F., Billot, B., Balbastre, Y., Williams Ramirez, J., Herisse, R., Deden-Binder, L.J., Casamitjana, A., Melief, E.J., Latimer, C.S. and Kilgore, M.D., 2024. Machine learning of dissection photographs and surface scanning for quantitative 3D neuropathology. Elife, 12, p.RP91398. doi
The machine learning slice imputation in the reconstruction is described in:
Crespo-Aguirre, M., Williams-Ramirez, J., Zemlyanker, D., Hu, X., Deden-Binder, L.J., Herisse, R., Montine, M., Connors, T.R., Mount, C., MacDonald, C.L., Keene, C.D., Latimer, C.S., Oakley, D.H., Hyman, B.T., Lawry-Aguila, A. and Iglesias, J.E., 2026. Improving neuropathological reconstruction fidelity via AI slice imputation. Acta Neuropathologica Communications. doi
Automatic segmentation model trained using nnUNet:
Williams Ramirez, J., Zemlyanker, D., Deden-Binder, L., Herisse, R., Garcia Pallares, E., Gopinath, K., Gazula, H., Mount, C., Kozanno, L.N., Marshall, M.S., Connors, T.R., Frosch, M.P., Montine, M., Oakley, D.H., Mac Donald, C.L., Keene, C.D., Hyman, B.T., Fischl, B. and Iglesias, J.E., 2026. A public generalizable AI tool for automated segmentation of coronal brain tissue slabs for 3D neuropathology. PLOS One, 21(8), p.e0355740. doi
- Isensee, F., Jaeger, P.F., Kohl, S.A., Petersen, J. and Maier-Hein, K.H., 2021. nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation. Nature methods, 18(2), pp.203-211.
Click here for a video with an overview of the method
Purpose
This manual provides an end-to-end guide for using the tools available in FreeSurfer to reconstruct dissection photographs of brain slabs into a 3D reconstruction for quantitative analysis. Reconstructions are done by registering photographs to a 3D reference such as an MRI, a post-mortem surface scan, or an atlas. The guide covers acquiring surface scans prior to slabbing, preparing tissue slabs for gross photography, and preprocessing photographs using the dissection_photo graphical user interface.
Requirements
The latest FreeSurfer development version sourced in your terminal.
- Model files (downloaded once):
the reconstruction model, downloaded into $FREESURFER_HOME/models
- A CUDA-enabled graphics card is optional: segmentation and reconstruction are much faster with one.
Overview
Acquire a 3D reference: either a surface scan or an MRI. Without one, slabs are registered to an atlas.
Photograph the tissue slabs
Preprocess the photos in the dissection photo GUI
Reconstruct the 3D volume
Downstream analysis of photographs
Part 1: Acquisition
Surface scanning
A surface scan of the specimen is taken after the cerebellum has been sectioned off and before the specimen is slabbed. The full scanning protocol is available on its own page: Surface Scanning Protocol.
Summary of the key requirements of a reference mesh:
- The cerebellum removed: it is not on the slabs, so including it in the scan leads to an incorrect reconstruction.
- The sides of the specimen captured.
A watertight mesh, saved as .stl. Small holes in the initial point cloud due to deep sulci are fine; these will be covered by the meshing process.
Preparing Slabs
The following guidelines should be followed when preparing slab images for optimal results.
Guidelines for Brain Slab Image Acquisition
There are some important requirements for the photographic setup of the brain slabs to ensure the best results.
Use a high-contrast background that stands out in uniform contrast to the brain slabs, such as a solid black background. This will make the slabs easier to segment downstream. Using a complex background with a color similar to your brain slabs will lead to more manual intervention, such as having to manually trace contours, which is not only time-consuming but also non-reproducible.
|
|
Low-contrast background: difficult to segment. |
High-contrast background: easy to segment. |
Additionally, all tissue block faces must face the same direction: all slices should be photographed either from the anterior or from the posterior view. Note that if slabs are photographed from the posterior view, the extra flag --photos_of_posterior_side must be used in the final reconstruction command.
When a single slice produces multiple tissue blocks, they should be placed as close to the original anatomy as possible. For example, after acquiring slices from the frontal pole, the initial blocks corresponding to the temporal lobe will often be detached from the main block. The following figure shows a) proper anatomical placement of tissue, and b) tissue placed too far apart, which is not anatomically accurate.
Tissue slab placement: a) properly placed tissue; b) tissue placed in a non-anatomical manner.
Another example of difficult tissue placement is the corpus callosum. The following figure shows a good setup, with a high-contrast background and good lighting. However, the placement of the corpus callosum on the rightmost slab is incorrect, which will negatively affect volumetric estimates of the third ventricle.
Markers for pixel and perspective corrections
To calibrate pixel size, the user needs to provide landmarks with known distances between them. The minimum requirement is a ruler, which provides two discrete landmarks. This enables rough pixel size correction. This method is preferable for legacy images that only have a ruler for reference.
Tip: It is better to use landmarks that are as far apart as possible, as the relative error when manually setting the reference in pixels per millimeter decreases with greater distances.
A more effective setup uses four landmarks placed at the corners of a rectangle of known dimensions. This enables us to correct for both pixel size and perspective. In the example below, we can easily tell that the 4 points marked on the grid define a rectangle of 170 x 200 mm.
The optimal scenario is to have 4 points defined by fiducial markers with highly salient features. This enables our software to recognize the fiducials automatically, which minimizes human interaction, reducing time and maximizing reproducibility. We strongly recommend that you print this set of fiducials and place them at the corners of the board.
Tip: For best results, affix the fiducials to a small piece of rubber, wood or plastic that lifts them X mm above the board, where X is the thickness of your typical brain slice. Lifting the fiducials minimizes the error caused by the surface of the brain slice not being in the same plane as the board, but a few millimeters above it.
The fiducials form the four corners of the corrected image; hence, all tissue should be within the rectangle formed by the four fiducials. The following image shows slab photos where the fiducials were not placed far enough apart.
Drawing a rectangle through the four fiducial markers makes it clear that much of the tissue lies outside of the pixel-corrected region.
In summary, here is an example of an optimal photographic setup: a uniform, high-contrast background, the provided fiducials located at known distances, and consistent lighting on all slabs.
Tip: It does not matter if the slabs are not placed on a grid, as long as the distance between the fiducials is known. The software will draw digital rulers on your images during pixel correction.
Part 2: Preprocessing Photographs with the Dissection Photo App
The dissection photo app has five principal windows for each subject: Add photos, Correction, Segmentation, Connected components and Reconstruction. The step bar at the top of the window shows which step is being done. Users can backtrack by clicking any of the previous steps at any time, or click the house icon to return to the Projects screen with a summary of all reconstructions done or in process. For each project, work is saved as you go, so the app can be closed at any time and you can pick up later where you left off.
Before continuing, make sure the development version of FreeSurfer is properly sourced, you have downloaded the model weights, and have set NNUNET_MODEL_DIR as an environment variable pointing to the segmentation model. To start the application, use the command dissection_photo_2.
Projects Page
Each specimen corresponds to a project: a folder which will be populated with the outputs from all steps. The project home contains a summary of all projects and their progress.
Projects Home screen.
To start processing a new batch of dissection photographs click on New Project.
- Open a project to continue where you left off or backtrack to any completed steps.
Tip: For advanced users, the gear icon can be used to change which resources are used by the automatic segmentation model, covered in automatic segmentation settings.
After naming a project you will be prompted to save a folder of the same name. It is in this folder that the outputs of all steps will be stored.
Directory Structure
For each project the following directory structure will be populated with all outputs.
Folder / file |
Contents |
photos/ |
Copy of the original photographs |
deformed/ |
Pixel-corrected photos |
mask/ |
Binary tissue masks |
connected_components/ |
Label maps per slab |
recon/ |
The 3D-photo reconstruction |
Step 1. Add photographs
Drag and drop a folder containing dissection photographs, or click Upload Images.
- Select the photographs that should be used for the reconstruction. This can be used to omit repeat photographs, dissection photographs of cerebellar tissue, or gross photographs done prior to slabbing. Double click on any image in the grid for a larger preview.
If you have or would like to create a calibration file to automate pixel correction, click on + Add a calibration file (optional) and follow the steps in Making a Calibration File and then Prospective Correction.
Click Get started.
|
|
Optional: Making a calibration file
This step only needs to be done once, as long as the markers are not moved. For more information on proper usage refer to the Markers for pixel and perspective corrections section in this wiki page.
On the Add photos menu, click + Add a calibration file (optional) to expand the calibration file box, and click on Create one under the Upload Calibration button.
On the next menu, if you have not printed out the fiducial markers, they can be downloaded for printing by clicking the Download Marker Printout button.
- Next, place markers at a known distance in a rectangle formation on the photography table. Be sure that opposite sides of the rectangle created by the fiducial markers are parallel; inaccurate marker placement can lead to incorrect perspective correction.
- Upload the photograph of the empty dissection table with just the markers present, and enter the width and height of the fiducial box.
- For each of the markers, click its centre and outer circle. Options to zoom, pan, and redo/undo can help fix mistakes and make the best calibration possible.
Click Save Calibration and save your calibration file in an easy-to-access location.
Tip: Because of slight lens distortion, the overlaid labels for the outer circle of the markers might not always align throughout the whole circumference. This is not an issue.
The photograph of the empty table with the four markers, uploaded.
|
|
Step 2: Pixel Correction
This step corrects all photographs to be at the same pixel size. Additionally, it can correct for perspective when using a calibration file, or when doing manual correction in 4-point mode.
Prospective Correction (Using fiducial markers and calibration file)
- Every photo is corrected automatically as soon as Correction opens. The markers are found in each photo separately, so it does not matter if the camera moved between photos.
Check each photo: Original shows the photo as taken, with the marker centres that were found; Corrected shows the result. A green tick in the strip at the bottom marks each corrected photo.
If the markers cannot be found in a photo, the app says which ones. On each of them, click the centres of the four markers on the Original view and click Correct this photo.
Retrospective Correction (Using a spatial reference within the photographs)
Choose how many points you can mark, enter the real distances, and place the points on each photo:
Mode |
You need |
Corrects |
2 Point |
One ruler or other known distance (entered as Ruler width (mm)) |
Pixel size only |
3 Point |
Three corners of a rectangle, e.g. two rulers at right angles |
Pixel size, approximate perspective |
4 Point |
Four corners of a rectangle |
Pixel size and perspective |
Ctrl + left click places a point; once all are placed, Ctrl + click moves the nearest one. Clear points starts again.
Click Correct this photo (Ctrl + W also moves on to the next photo). Place points on the Original view; the Corrected view is for checking.
|
|
When every photo is corrected, make sure to click Continue to Segmentation.
Step 3: Binary Segmentation
While you were correcting, the app was already finding the tissue in each corrected photo. Here you check each mask and fix it.
|
|
Brush (Q) adds to the mask, Eraser (W) removes from it, and Fill (E) fills an area. Apply the tool with Ctrl + left drag; set the sizes with the sliders.
Mask opacity changes how see-through the mask is; Show mask (Ctrl + T) hides and shows it. Undo and redo with Ctrl + Z and Ctrl + Shift + Z.
- Leave out everything that is not slab tissue: the background, labels, and fragments that do not belong to a slab.
IMPORTANT: the cortical surface should not be part of the masks, so the first slab (if photographed from the anterior side) or the last slab (if photographed from the posterior side) should NOT be included.
You need to look at every photo's mask before Continue to Connected Components becomes available; a note at the top says which ones are left.
Automatic Segmentation Settings
Open them from the gear on the Projects screen. Changes apply the next time photos are segmented.
Automatic segmentation settings.
Setting |
What it does |
Automatic segmentation (On / Off) |
Off: every mask is drawn by hand from scratch. Only turn it off if the automatic segmentation fails on your photos. |
Model folds |
Automatic: 5 folds on a GPU, 1 on the CPU. Five folds are steadier but 4-5x slower. |
Run on |
Automatic uses the GPU if there is one; or choose GPU or CPU. |
Maximum threads |
The most processor threads segmentation may use. If the computer has fewer, it uses all it has. |
Model folder |
The folder of the segmentation model (nnUNetTrainer__nnUNetPlans__2d). |
Step 4: Slab Connected Components
Here you tell the app which pieces of tissue belong to which slab.
- In each photo, draw a box inside each slab (Ctrl + left drag), always in the same order: anterior to posterior, or posterior to anterior. The slab is colored as soon as its box is drawn.
- Keep boxes small and inside the tissue, and do not let them overlap. If a slab is in several pieces (e.g. a detached temporal lobe), make sure its box touches every piece.
Click Save components (Ctrl + W also moves on to the next photo); moving to another photo saves it too. A green tick marks saved photos. If you change a saved photo, its tick goes away until you save it again.
Undo and redo with Ctrl + Z and Ctrl + Shift + Z. Slab overlay changes how strongly the slabs are colored.
Before any boxes are drawn.
|
|
Step 5: Photo Reconstruction
Please see our separate page on the command mri_3d_photo_recon. The last step runs mri_3d_photo_recon on the images of the project. While the reconstruction is running in the background the user can continue processing images of other cases.
Output folder: the folder inside the project for the results (default recon).
Slabs: the hemisphere, the slab thickness in mm, which face of the slabs was photographed (anterior or posterior), the order the photos were taken in, and whether the tissue is fixed or fresh.
Reference: none (the MNI atlas), a surface mesh (.stl), an MRI scan, or both. See Which reference should I use?
- Optionally: the number of threads, a graphics card, and the advanced settings. Empty expert weights use the command's own defaults, shown in grey.
Click Run Reconstruction.
The command being run is shown on the right (Copy command copies it, for example to run it on another computer), and its output appears in the log below it. The reconstruction keeps running if you switch to another project; the Projects screen shows its progress.
A reconstruction running, with the command and its log.
Part 3: Downstream Tasks
Photo-Synthseg Segmentation
The 3D reconstructed stacks can be segmented with SynthSeg using the flag --photo. Please see the wiki page for SynthSeg for further information.
|
|
Example for running SynthSeg on a Left Hemisphere
mri_synthseg \
--i ./recon/photo_recon.mgz \
--o ./recon/photo_recon_synthseg.mgz \
--photo left \
--parc
