Repository navigation
Bronchoscopic Depth Map Generation
Bronchoscopic Depth Map Generation uses a deep learning model (3cGAN by default) to estimate a depth map: an image representing how far away each part of an image is from the camera. It is for images from a monoscopic camera/endoscope rather than stereoscopic cameras/endoscopes. It was intended for use with Video Input. In addition, the depth map can be reconstructed into a point cloud using the camera intrinsics, however the scaling will need to be manually adjusted as no true distance information is received.

This tutorial uses a porcine sample recording. See Sample data.
This module requires PyTorch:
- Install the PyTorch extension from the Extensions Manager and restart Slicer.
- Open Utilities > PyTorch Utils and install PyTorch. This chooses the version that matches your GPU, if you have one.
The first time you generate a depth map, the module asks to download the model weights. They are saved in Slicer's cache folder.
· · ·
- Load an image. Either:
- Add an image into Slicer, or
- Use the volume from Video Input
- In Input / Output:
- Input Volume: select the image. It must be a single 2D image. Color images are automatically converted to grayscale.
-
Output Volume: create a volume or leave it empty. If left empty, a volume named
DepthMapis created.
- Click Generate Depth Map.
The depth map has the same size and position as the input. Brighter areas represent further distance from the camera.
- Use GPU if available is ticked by default.
- Without a GPU, the model runs on the CPU, which works but is slower.
DepthMap_Single.webm
· · ·
- Start playing a video, image sequence or webcam in Video Input.
- In Input / Output:
- Input Volume: select a volume.
-
Output Volume: create a volume or leave it empty. If left empty, a volume named
DepthMapis created.
- Click Run Continuously. A new depth map is generated each time the input image changes.
- Click Stop to end.
- Maximum Frame Rate limits how many depth maps are generated per second. Lowering it reduces the load on the computer.
The depth map has the same size and position as the input. Brighter areas represent further distance from the camera.
- Use GPU if available is ticked by default.
- Without a GPU, the model runs on the CPU, which works but is slower.
DepthMap_Continuous.webm
· · ·
- Generate a depth map, once or continuously.
- In Point Cloud Generation:
- Tick Enable Point Cloud.
-
Point Cloud: create a model or leave it empty. If left empty, a model named
PointCloudis created.
- Show the point cloud in a 3D view. It is updated with each depth map, including while running continuously, and whenever a setting changes.
Camera settings:
- Camera Intrinsics: the focal lengths and principal point of the camera, in pixels of the depth map. If they are unknown, the defaults with Principal point at image center can be used.
- Camera Transform (optional): the position and direction of the camera. The point cloud will be placed under this transform.
Point settings:
- Scale: the size of the point cloud in millimeters at the farthest depth, across the image (X, Y) and along the viewing direction (Z).
- Depth Range: threshold out depths outside of this range. The model's accuracy can decline at close and far distances.
- Pixel Density: the percentage of pixels that are rendered as points.
- Color points from the input image: colors each point with the color of its pixel in the input image.
DepthMap_PointCloud.webm
Banach A, King F, Masaki F, Tsukada H, Hata N. Visually Navigated Bronchoscopy using three cycle-Consistent generative adversarial network for depth estimation. Medical Image Analysis 73 (2021) 102164. doi:10.1016/j.media.2021.102164
