# Zooming into microscopy data using 3D Slicer

**URL:** <https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288>\
**Category:** Development\
**Created:** [May 10, 2017, 12:50pm UTC](https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288 "2017-05-10T12:50:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [May 10, 2017, 12:50pm UTC](https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288/1 "2017-05-10T12:50:49Z")

</div>

Hi all,

During [2016 Summer Slicer Week](https://www.na-mic.org/Wiki/index.php/2016_Summer_Project_Week) we worked on a [project](https://www.na-mic.org/Wiki/index.php/2016_Summer_Project_Week/Brain_atlas_combining_histology_and_MRI) using histology to build an atlas. @pieper gave me some useful tips for this.

Here’s a video Tina asked me to upload:

Sonia and Steve said this could be interesting for @fedorov and the `Slicer Pathology` extension. More recently, Sonia was in Paris and asked me about the code for the widget. I told her I hadn’t shared it because it was not clean, not integrated and has a lot of limitations. She said I should share it as it is, since someone else might want to contribute to improve it and maybe integrate it into Slicer at some point. I’ve worked a bit in order to integrate the widget into `DataProbe.py`.

Some of the many caveats:

1. Only 2D images are supported
2. Only RGB images supported (probably very easy to make it work for grayscale as well)
3. Currently uses the background image of the red slice

Here’s the code: [https://github.com/fepegar/Slicer-DataProbe-Histology/blob/master/DataProbe.py](https://github.com/fepegar/Slicer-DataProbe-Histology/blob/master/DataProbe.py)  
It replaces `Slicer-build/lib/Slicer-4.7/qt-scripted-modules/DataProbe.py`.

I tipically use the widget for images like [this](https://www.dropbox.com/s/kj8wjbdau3k0u52/TC2_1_rgb_small.nii.gz?dl=0) (that’s a downsampled version, as histology images are usually very large).

Best,  
Fernando

---

<div class="post-metadata">

**Author:** ![Davide\_Punzo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/davide_punzo/32/66104_2.png) [@Davide\_Punzo](https://discourse.slicer.org/u/Davide_Punzo)\
**Post date:** [May 10, 2017, 5:45pm UTC](https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288/2 "2017-05-10T17:45:21Z")

</div>

Hi Fernando, thanks! This utility will be very useful also for my astronomical use cases. I guess the best way to allow extensions to use it, it is to clean and integrate the modifications in the core. The only problem will be to understand if it is useful also for the others and how to integrate it without making the interface too complicated and crowded (e.g., we want it only for the red slice, or also for the other ones? or a menu for swtiching?).

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 10, 2017, 7:27pm UTC](https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288/3 "2017-05-10T19:27:38Z")

</div>

Probably it’s better to put this into a docking widget (similarly to the Python interactor). The widget can be popped out, moved to another screen, etc. or can be snapped to a side of the screen or below/above any other docking widget. See an example here: [https://github.com/SlicerRt/SlicerDebuggingTools/blob/master/NodeInfo/NodeInfo.py#L224-L257](https://github.com/SlicerRt/SlicerDebuggingTools/blob/master/NodeInfo/NodeInfo.py#L224-L257)

I would not put anything into already too crowded and too big Data probe widget.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 10, 2017, 7:46pm UTC](https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288/4 "2017-05-10T19:46:59Z")

</div>

Seems like this could be a generalization of the Slice Intersections  
concept, but showing the borders of another slice view as an overlay on an  
slice view that has the same orientation and offset. That would give a lot  
of flexibility since it would handle arbitrary orientations and would also  
allow panning and zooming of either slice (or showing multiple slice views  
at different zoom levels all with their outlines visible in the ones that  
are more zoomed out (or multiple insets in the same large image).

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 10, 2017, 7:51pm UTC](https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288/5 "2017-05-10T19:51:45Z")

</div>

That’s a great idea. We had problems in the past with intersection of nearly-parallel slices anyway (intersection lines showed up in unpredictable locations). If we detect that slices are parallel, we could show intersection with a ribbon around the slice boundary.

---

<div class="post-metadata">

**Author:** ![Fernando](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fernando/32/5640_2.png) [@Fernando](https://discourse.slicer.org/u/Fernando)\
**Post date:** [May 10, 2017, 8:16pm UTC](https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288/6 "2017-05-10T20:16:46Z")

</div>

Good ideas! Something like this? (This image is photoshopped)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/8/38a6809811b9e4f4c6632be4ec45d8c4828f2adb.jpeg)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 10, 2017, 8:23pm UTC](https://discourse.slicer.org/t/zooming-into-microscopy-data-using-3d-slicer/288/7 "2017-05-10T20:23:36Z")

</div>

Yes. It would be useful to improve slice intersection display also for thick slice reformatting (to show the slice thickness). vtkMRMLModelSliceDisplayableManager should be tuned to display slice intersections differently than regular model nodes (at least when the slice model is nearly parallel to the current slice and when slices are thick). Mantis issue describing incorrect slice intersection display for nearly-parallel slices: [https://www.na-mic.org/Mantis/view.php?id=3360](https://www.na-mic.org/Mantis/view.php?id=3360)
