# SlicerQR Development

**URL:** <https://discourse.slicer.org/t/slicerqr-development/15954>\
**Category:** Development\
**Tags:** registration, build, segmentation, dicom, python\
**Created:** [February 11, 2021, 3:59pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954 "2021-02-11T15:59:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 11, 2021, 3:59pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/1 "2021-02-11T15:59:23Z")

</div>

@jcfr @pieper @lassoan @superlib

Good Morning. I’m starting to think about how to deploy SlicerQR to 25,000 PCs across the Mayo Enterprise. After building the package, it consists of over 7000 files at a total size of over 700MB. It would be seriously frowned-upon to propose deploying it to 25,000 PCs. So, my question is: Would there be any disadvantages to placing the installation in 1 place on a file share and have the users execute SlicerQR from a folder there? Would there be conflicts with sharing? Once the app is loaded into local memory, what are potential problems with a common launch path?

---

<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:** [June 8, 2021, 5:51pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/2 "2021-06-08T17:51:23Z")

</div>

38 posts were split to a new topic: [Slicer custom application deployment to many computers](https://discourse.slicer.org/t/slicer-custom-application-deployment-to-many-computers/18019)

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 19, 2021, 5:21pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/22 "2021-02-19T17:21:22Z")

</div>

@lassoan @pieper @jcfr @Sankhesh_Jhaveri

Question: Do any of you know my friend, Hunter Downs?

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 24, 2021, 8:59pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/41 "2021-02-24T20:59:50Z")

</div>

Question: Do you all do anything with A.I. in imaging?

---

<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:** [February 25, 2021, 6:28am UTC](https://discourse.slicer.org/t/slicerqr-development/15954/42 "2021-02-25T06:28:49Z")

</div>

> [@Slicer custom application deployment to many computers](https://discourse.slicer.org/t/slicer-custom-application-deployment-to-many-computers/18019/38):
>
> might I be able to get the size down significantly smaller than 300MB? Sankhesh’s 2018 FourPanesViewer app was has a total size of 60MB and had similar functionality.

The FourPanesViewer is pure VTK. It has no GUI widgets, no proper DICOM parser, no proper widgets, etc. The Slicer core will not be significantly smaller than 300MB just by removing DLLs, but you would need to reengineer the application. Since 300MB is smaller than a typical image that the user downloads by the dozens and you don’t actually need to deploy the 300MB Slicer, only a 10MB launcher, the effort for reengineering (and maintain the ultra-lean Slicer core) is very hard to justify.

> [@spycolyf](#):
>
> Question: Do you all do anything with A.I. in imaging?

Yes, AI is a very trendy topic, so there is lots of activity around it in the Slicer community, too. This is a good example of why creating an ultra-lean Slicer core would not worth the effort: users would keep asking for enabling features and we would end up using the full Slicer core quite quickly.

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 25, 2021, 4:40pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/43 "2021-02-25T16:40:39Z")

</div>

Thanks @lassoan,

I know I’m flooding you with questions here. Here’s more…

1. What are you using for DICOM parsing. In FourPanesViewer, I am using David Gobbi’s vtkDICOM functions to parse DICOM. I think Gobbi’s objects have been integrated into VTK installations in VTK 9.

2. I’m also using GDCM for JPEG 2000 decompressing. Does Slicer handle JPED 2000 compression? If so, how? I’m still diving into the code, and it helps to know what to look for.

Thanks

---

<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:** [February 25, 2021, 4:44pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/44 "2021-02-25T16:44:12Z")

</div>

> [@spycolyf](#):
>
> What are you using for DICOM parsing. In FourPanesViewer, I am using David Gobbi’s vtkDICOM functions to parse DICOM. I think Gobbi’s objects have been integrated into VTK installations in VTK 9

vtkDICOM can handle basic DICOM - 3D Cartesian volumes with uniform spacing. No 2D+t, no 3D+t, no DICOM segmentation objects, no DICOM RT structure sets, etc. It cannot handle some of the technically valid but tricky series (such as overview orthogonal slice embedded in the series; series that contain slices with multiple orientations, …). You cannot rely on this if user may want to be able to open images acquired with a variety of devices, using a variety of imaging protocols.

> [@spycolyf](#):
>
> I’m also using GDCM for JPEG 2000 decompressing. Does Slicer handle JPED 2000 compression? If so, how?

Yes, Slicer uses GDCM and DCMTK, both can handle compressed DICOM images. Not all compression types are supported (for example, h264 video compression is not), but jpeg is, and I think jpeg2000, too.

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 25, 2021, 10:22pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/45 "2021-02-25T22:22:19Z")

</div>

Wow, that’s great to know about vtkDICOM. I was really going in the wrong direction. Y’all saved my life. Thanks.

I might be mistaking, but I’m under the impression that DCMTK does not handle JPEG 2000 compression. If so, it a recent development. Liqin wrote our QREADS DICOM receiver and is now using GDCM because DCMTK either did not do JPEG 2000, or there were issues with it.

Thanks @lassoan

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 25, 2021, 10:31pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/46 "2021-02-25T22:31:18Z")

</div>

Also, I did inform my team that the smallest size we might could possibly achieve is around 300MB. So, we will come up with a deployment scheme that will work. When I suggested the possibility of SlicerQREADS (SQR) staying up in the background once launched, the concern was what if QREADS it terminated and SQR becomes orphaned? Obviously, SQR would need to detect QREADS PID presence at some short interval when SQR is not in focus. The QREADS PID would be passed as an argument to SQR upon launching.

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 26, 2021, 12:31am UTC](https://discourse.slicer.org/t/slicerqr-development/15954/47 "2021-02-26T00:31:20Z")

</div>

@lassoan @pieper @jcfr - Question: As you know, building SlicerQREADS can take hours. I know if I make changes to the Python script, I don’t have to rebuild. But do I need to perform the 3 hour rebuild if I make a small modification to the C++ code?

---

<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:** [February 26, 2021, 3:53am UTC](https://discourse.slicer.org/t/slicerqr-development/15954/48 "2021-02-26T03:53:15Z")

</div>

You only need a full build once. After you make modifications in the C++ source files and build again then only the changed files are compiled and linked, which typically takes about 15-30 seconds.

---

<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:** [February 26, 2021, 4:20am UTC](https://discourse.slicer.org/t/slicerqr-development/15954/49 "2021-02-26T04:20:18Z")

</div>

> [@spycolyf](#):
>
> I’m under the impression that DCMTK does not handle JPEG 2000

DCMTK tried to make some income from not bundling JPEG2000 codec with the free DCMTK version. Slicer falls back to read with GDCM if DCMTK fails to decode an image.

> [@spycolyf](#):
>
> the concern was what if QREADS it terminated and SQR becomes orphaned?

There are many options for solving this, but checking if QR process is running (based on PID) would be an easy way of doing it.

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 26, 2021, 3:21pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/50 "2021-02-26T15:21:54Z")

</div>

OK, great! Can the incremental build be done from the command line as well as in the VS IDE?

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 26, 2021, 3:30pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/51 "2021-02-26T15:30:58Z")

</div>

@lassoan @jcfr @pieper,

Could any of you please describe your Slicer development environment to us. Do you use a text editor for Python, or an IDE? PythonQT? I’m sure you use Visual Studio. What is the proper development environment for us here at Mayo. We need to rapidly ramp up to start developing.

Most urgent id to eliminate the Kitware splashes and brightening the colors of the cross reference markers on the images.

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 26, 2021, 6:16pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/52 "2021-02-26T18:16:48Z")

</div>

@lassoan @jcfr @pieper,

OK, I’m finally starting to understand. I know you’ve been trying to tell me many time in the past, it’s mostly about the Python! OK, I’m looking for the python code for the following:

1. To set the colors of the reference markers on my four image panes.
2. Eliminate the Kitware splashes upon launching
3. Perform window / level interactively with the left and right mouse button pressed and dragging.

Thanks,

Doug Porter

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [February 26, 2021, 8:01pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/53 "2021-02-26T20:01:59Z")

</div>

> [@spycolyf](#):
>
> To set the colors of the reference markers on my four image panes.

Can you provide an image of what you mean here? I’m not sure which object you are talking about.

> [@spycolyf](#):
>
> Eliminate the Kitware splashes upon launching

Are you using the Slicer Custom App framework? There is an example of such a customized Slicer application at [https://github.com/KitwareMedical/SlicerCAT](https://github.com/KitwareMedical/SlicerCAT). Included things is changing the logos used in the application and the splash screen. You would update the images files as are specified at [https://github.com/KitwareMedical/SlicerCAT/tree/master/Applications/SlicerCATApp/Resources/Images](https://github.com/KitwareMedical/SlicerCAT/tree/master/Applications/SlicerCATApp/Resources/Images).

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [February 26, 2021, 10:47pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/54 "2021-02-26T22:47:18Z")

</div>

@jamesobutler @lassoan @pieper @jcfr

Thank you @jamesobutler. Pleased to meet you. Yes, I am using the Slicer Custom App framework, here is a picture of what I mean by reference markers. Also, I need to lighten up the background colors of the textboxes containing the slice locations in the upper right corner of each image pane. Or better still, make the text white.

 ![SlycerQREADS_RefMarkers](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/2/02d2bd8763d7f618d09a2d7dc3bb84b39b7417a0.jpeg)

My managers are saying that the reference markers are too dark and are sometimes difficult to see. I’m just learning how to program Slicer. Here is the Python code that creates the reference markers…

Here’s some code setting them visible. Is there a reference manual somewhere, or a way to discover available Slicer methods for certain objects? Is there an IDE with intellisense?

```python
  def setReferenceMarkersVisible(visible):
         for sliceLogic in slicer.app.applicationLogic().GetSliceLogics():
              sliceLogic.GetSliceCompositeNode().SetSliceIntersectionVisibility(visible)
              sliceLogic.GetSliceNode().SetWidgetVisible(visible)

```

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [February 27, 2021, 12:08am UTC](https://discourse.slicer.org/t/slicerqr-development/15954/55 "2021-02-27T00:08:26Z")

</div>

Ok I see. The slice controller area of the slice views. Have you registered a custom layout in that image there (as in [customize view layout](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Customize_viewer_layout))? That’s how a custom layout can be created which allows you to specify different colors for the slice viewers. I’m not aware of a a specific layout view that looks like that in the latest versions of Slicer.

As it relates to python autocomplete you can see the state of things from this older thread. Note that I really haven’t tried it any further. As it relates to figuring what methods are supported by various objects I often use the python interactor in slicer and just use tab completion to look into the available methods. So like volume\_node.[PRESS TAB].

> [@Developing Slicer modules in Visual Studio / Visual Studio Code?](https://discourse.slicer.org/t/developing-slicer-modules-in-visual-studio-visual-studio-code/9496/12):
>
> I was able to get auto completion within Visual Studio Code on Windows following these settings: “C:\Users\JamesButler\AppData\Roaming\Code\User\settings.json” { "python.pythonPath": "C:\\Program Files\\Slicer 4.11.0-2019-12-06\\bin\\SlicerPython", "python.autoComplete.extraPaths": [ "C:\\Program Files\\Slicer 4.11.0-2019-12-06\\", "C:\\Program Files\\Slicer 4.11.0-2019-12-06\\lib\\Python", "C:\\Program Files\\Slicer 4.11.0-2019-12-06\\lib\\QtPlugins", "…

Some further python debugging content can be found linked from [https://slicer.readthedocs.io/en/latest/developer\_guide/build\_instructions/windows.html?highlight=python%20interactor#debugging-python-scripts](https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/windows.html?highlight=python%20interactor#debugging-python-scripts).

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [February 27, 2021, 12:21am UTC](https://discourse.slicer.org/t/slicerqr-development/15954/56 "2021-02-27T00:21:41Z")

</div>

> [@jamesobutler](#):
>
> Ok I see. The slice controller area of the slice views. Have you registered a custom layout in that image there […]?

@jamesobutler custom layout is indeed registered

@spycolyf The color are consistent with the original design you shared with me. Which colors should be used instead ? Providing the hexadecimal code for each colors would be ideal.

---

<div class="post-metadata">

**Author:** ![spycolyf](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@spycolyf](https://discourse.slicer.org/u/spycolyf)\
**Post date:** [March 1, 2021, 3:29pm UTC](https://discourse.slicer.org/t/slicerqr-development/15954/57 "2021-03-01T15:29:54Z")

</div>

@jamesobutler @jcfr @pieper @lassoan,

Thanks everyone for your extremely helpful responses. I’ll responding in more detail when I return from my tax appointment in about an hour. But here’s my immediate answer to @jcfr 's question. Same colors, but lighter. I will send the hex shortly. Question though: can the reference marker line colors be adjusted independently of the image background colors? Id like the background colors to remain the same, but the ref line colors to be brighter which corresponds to the 3D graphics boundary lines in the lower right quadrant. If not independent I will pick the best overall color. Thanks.

[Next page](https://discourse.slicer.org/t/slicerqr-development/15954.md?page=2)
