I’m working on Slicer CAT where I need to display different 3D data (the data represent the geological objects) in XYZ domain where X, Y axes - has the meaning of geographic coordinates (meters) and Z - is the depth (zero is the ocean water level) or time (meters or milliseconds). Right handed coordinate system: X-to the east, Y-to the north, Z-out of the Earth.
I need to provide ability to zoom Z-axis independently from X and Y. That leads that the scales along X,Y will differ from Z-axis.
Maybe Slicer already has such opportunity? If not maybe you have some recommendations/links and especially should I implement it in Slicer core library via Slicer-github pull request or only in my Slicer CAT?
Yes, all of that should be pretty doable. You could have a look at SlicerAstro, which also adapted a lot of things to deal with different coordinate meanings so I’d think a lot of the hooks that @Davide_Punzo added will be of use to you.
Is there precompiled bindary of Slicer Astro for Windows?
In general, yes, you can just install the extension.
But it looks like there may be a build issue on windows currently. Looks like mac and linux are working.
I’m trying to build Slicer Astro but there are some things…
My slicer cat (named Colada) is in
C:/C and the build folder
Slicer Astro is in
C:/A and the build folder
Then I do (using IDE though the commands should be similar):
cmake .. -DSlicer_DIR=C:/C/d/Slicer-build
cmake --build .
Then I can see that only
SlicerAstroWelcome module is built. Can’t understand why…
How to add this extension to my Slicer CAT? Do I need to add all the path to Slicer Astro’s built modules (via `Edit->Application Settings->Modules->add)?
If I try to execute
C:\A\d\SlicerWithSlicerAstro.exe in cmd I get:
PS C:\A\d> ./SlicerWithSlicerAstro.exe
error: File specified using --launcher-additional-settings argument does NOT exist ! [C:/A/d/AdditionalLauncherSettings.ini]
--launcher-help Display help
--launcher-version Show launcher version information
--launcher-verbose Verbose mode
--launch Specify the application to launch
--launcher-detach Launcher will NOT wait for the application to finish
--launcher-no-splash Hide launcher splash
--launcher-timeout Specify the time in second before the launcher kills the application. -1 means no timeout (default: -1)
--launcher-load-environment Specify the saved environment to load.
--launcher-dump-environment Launcher will print environment variables to be set, then exit
--launcher-show-set-environment-commands Launcher will print commands suitable for setting the parent environment (i.e. using 'eval' in a POSIX shell), then exit
--launcher-additional-settings Additional settings file to consider
--launcher-additional-settings-exclude-groups Comma separated list of settings groups that should NOT be overwritten by values in User and Additional settings. For example: General,Application,ExtraApplicationToLaunch
--launcher-ignore-user-additional-settings Ignore additional user settings
--launcher-generate-exec-wrapper-script Generate executable wrapper script allowing to set the environment
--launcher-generate-template Generate an example of setting file
--VisualStudioProject Open Visual Studio Slicer project with Slicer's DLL paths set up
--cmd Start cmd
--designer Start Qt designer using Slicer plugins
--VisualStudio Open Visual Studio with Slicer's DLL paths set up
I just saw that slicer astro is unix only
I have installed Slicer Astro on Ubuntu, definately there are some useful features.
But I can’t find a way to make independent zooming along chosen axis…
Perhaps I postpone this task for a while and try get a little experience of writing/modifying Slcier’s widgets that are on the scene (on the picture, I think they are called
This question has come up before and I think setting slice field of view manually worked acceptably for that use case. However, it would be a much cleaner solution to simply apply a transform to the volume that scales it down along an axis.
I’m afraid that I need to work in XYZ coordinate system and all the data (not only volumes, but everything that is on scene) must be hard linked to axes… But thank you, I’m going to take some time to investigate the problem
Could ypu please give a hint how to acieve widgets from the scene and add widgets there (widgets are shown on the picture)
You can apply linear transforms to all node types, not just volumes. Also, you can unregister default measurements in markups nodes and register your own custom measurements that take into account the changed scale when reporting length/area/volume values.
There should be examples for this in the script repository, but the idea is that you l get widgets via the layout manager and then manipulate child widgets using standard Qt API.
In SlicerAstro there isn’t s feature to zoom just one axis. However you could easily add in Python some widgets (e.g. sliders) in the slide pop up menu on which you could modify the field of view of the slice (i.e. you modify the attributes of the MRML slice object associated to the slice widget). Modifying the mouse zooming interaction is more complicated.
In general, regarding a full coordinates customization, you may have a look at the custom classes in the AstroVolumes module (the MRMLDM classes and the widgets, something like SlicerAstroController etc…) and few tweaks in Python (SlicerAstroDataProde module). The implementation is mainly in C++ and somewhat tricky if you don’t have a full picture of Slicer infrastructure.
Thank you, I have found example how to customize 3d view and slice widgets here.
@Davide_Punzo thank you for explanation. Step by step I’m getting known with Slicer philosophy. Probably a little later I will come back to this task and reread this topic. I guess that should help me
It seems that I can set transform to the vtkCamera. And I tested with VTK 9.0.1 it works.
transform->Scale(2, 1, 1);
Though there are some problems that is connected with
P.S. as I have previously created topic dedicated to adding vtkCubeAxesActor to the Slicer’s scene, I think I should discuss the mentionned problem there.
I’m trying to set transfrom on camera but it seems that this only affect on 3D view:
# Getting camera from 3D view
layoutManager = slicer.app.layoutManager()
view = layoutManager.threeDWidget(0).threeDView()
threeDViewNode = view.mrmlViewNode()
cameraNode = slicer.modules.cameras.logic().GetViewActiveCameraNode(threeDViewNode)
# Getting camera
renderWindow = view.renderWindow()
renderers = renderWindow.GetRenderers()
renderer = renderers.GetItemAsObject(0)
camera = cameraNode.GetCamera()
# Create `transform` object and set scales for it
transform = vtk.vtkTransform()
transform.Scale(2, 1, 1)
# Apply transform to the camera
With this I get scaled 3D view but none of the Slice view is affected by scale. It seems that there is no camera on Slice view.
I understand that I can apply transform directly on volume but in this case coordinates of my object will be broken. I need to keep the original coordinates of object untouched…
What can I do to apply independently scale axes in slice view? I don’t fully understand yet how what are slice-views represented in sense of VTK objects, but probably I could set fake camera on them?
You can change the aspect ratio of slice views by simply setting the desired field of view in the slice node.
Thank you very much!
With this I see how to solve my issue with zooming. At least I think so