-
Notifications
You must be signed in to change notification settings - Fork 7
Home
* [x] Proper visualization of astronomical data cubes: using data astronomical data formats, such as FITS, and astronomical world coordinates system (WCS); * [ ] Quantification: visualization of the beam, generation of Histogram, flux density profiles, moment maps and position-velocity diagrams, statistics linked with the 3-D view, masking volumes with segmentations; * [x] Enabling interactive smoothing in all three dimensions; * [x] Interactive HI data modeling coupled to visualization; * [ ] Introduction of the SAMP protocol to enable interoperability with Topcat, and other VO tools and catalogs.
Additional Users documentation (first-time users are advised to check it): https://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/SlicerAstro
Developers documentation: coming soon...
Check also:
https://arxiv.org/abs/1505.06976
https://arxiv.org/abs/1609.03782
SlicerAstro is a work in progress project. Below you can find a detailed list of the current status. Please, report any bug and error that you may encounter (https://github.com/Punzo/SlicerAstro/issues).
* [x] FITS reader and AstroVolume done; * [x] WCS included in AstroVolume; * [x] Added AstroLabelMapVolume (WCS compatible); * [x] Generalization of qSlicerUnits; * [x] Slicer dataProbe moduile overrided with AstroDataProbe one; * [x] First desing of the AstroVolume interface done; * [x] Added WCS axis in the 2-D views; * [x] Customization of 2-D and 3-D Views; * [x] Welcoming to SlicerAstro and AstroSampleData modules implemented; * [x] Done! * [ ] Beam; * [ ] Histogram; * [ ] flux density profiles; * [ ] easy creation of contour plots; * [ ] moment maps; * [ ] position-velocity diagrams and linking with the projected model rotation curve; * [ ] statistics; * [ ] module for cropping / masking volumes with segmentations (taking care of WCS); * [x] module created; * [x] interface designed; * [x] Logic methods implemented on CPU (OpenMP); * [x] Logic methods implemented on GPU (OpenGL); * [x] Done! * [x] implementing CloudLasso (3-D Lasso) effect in the segmentation editor; * [x] implementing interface for easy conversion of AstroLabelMapVolume to/from SegmentationNode; * [x] adding tilted-ring model routine (3DBarolo); * [x] Done! * [ ] implementing SAMP protocol in SlicerAstro; * [ ] skill to overlay observations at different wavelength (i.e. different WCS and gridding); * at the moment datacubes NAXIS>3 not supported (NAXIS=4 and NAXIS4=1 -> NAXIS=3). * In Slicer is possible to overley two datacube in the 2-D Views. However, at the moment, SlicerAstro does not perform any regridding and/or reprojection operations. This means that, at the moment, the user should take care to load datacubes with same gridding and and same WCS if she/he desires to overlay them on the 2-D Views. * at the moment the SlicerAstro is not aware of the CELLSCAL keyword. * 3-DSlicer, at the moment, uses Qt4.8.5. For example, using last versions of Ubuntu, it may happen to spot odd behaviour for the popup menus. This will be solved by the upgrade of 3-DSlicer to Qt5 (see https://www.slicer.org/slicerWiki/index.php/Documentation/Labs/Qt5). * OpenGL filters in the current binaries are disabled. They require Slicer_VTK_RENDERING_BACKEND set to OpenGL2 (current 3-DSlicer binaries use OpenGL; https://www.slicer.org/wiki/Documentation/Labs/VTK7). If such features is required the user may try to compile 3-DSlicer following https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions and setting in cmake Slicer_VTK_RENDERING_BACKEND=OpenGL2.SlicerAstro is an official 3-DSlicer extension. Please, download 3-DSlicer nightly build:
http://download.slicer.org/donwload SlicerAstro using the 3-DSlicer extension manager tool (available for Linux and MAC): http://wiki.slicer.org/slicerWiki/index.php/Documentation/Nightly/SlicerApplication/ExtensionsManager
After the installation, please configure the settings (not necessary, but suggested) with the following instructions (to open the setting interface, you may press ctrl+2 / Command ⌘+2):
- Volume Rendering: setup if the default rendering pipeline runs on CPU or GPU (and the amount of your DRAM).
- Modules: A) toggle Skip loading of any for the command-line plugins; B) restart; C) Remove all the remaining medical modules by untoggling all the modules which are not included in the following list: Annotations, AstroDataProbe, AstroDataSample, AstroVolume, Cameras, Colors, Data, DataProbe, DataStore, Markups, Reformat, Scene Views, Screen Capture, Segment Editor, Segmentations, Smooth Volume, Subject Hierarchy, Tables, Transforms, Units, Volume Rendering, Volumes, Welcome to Slicer, Welcome to SlicerAstro, Smooth Volume.
- Set the default startup module: Welcome to SlicerAstro.
- Set as favourite modules the Astro ones.
- Restart
For general information about 3-DSlicer and tutorials we refer to
- http://www.slicer.org/
- http://slicer.org/slicerWiki/index.php/Main_Page
- http://slicer.org/slicerWiki/index.php/Documentation/Nightly/Training
For information about the GUI and the navigation, we refer to the Slicer documentation:
- http://slicer.org/slicerWiki/index.php/Documentation/Nightly/SlicerApplication/MainApplicationGUI
- http://www.na-mic.org/Wiki/images/7/71/3DDataLoadingandVisualization_SoniaPujol_slicer4.4.pdf
- and Welcome module (see the picture below)
Markups and crosshair are also very useful tools. Please, check the following links:
- http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/SlicerApplication/MouseandKeyboardShortcuts
- http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Modules/Markups

Check https://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/SlicerAstro
It is a very useful util to access run-time the Slicer classes (e.g. the data of the fits file are stored in the AstroVolume class). Python script can also be runned typing on termianl Slicer --python ...
See:
- https://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/Python_scripting
- http://www.slicer.org/slicerWiki/images/d/d7/Slicer4_ProgrammingTutorial_SPujol-SPieper_slicer4.4.pdf

- SmoothRenderSaveVideos.py:
slicer.util.loadVolume("/full_path/galaxy.fits",{"center":True})
mw = slicer.util.mainWindow()
ms = mw.moduleSelector()
# Smooth the datacube
ms.selectModule('AstroSmoothing')
smowidget = slicer.modules.astrosmoothing.widgetRepresentation()
smomrmlpara = smowidget.mrmlAstroSmoothingParametersNode()
smomrmlpara.SetMode("Manual")
# only if a GPU is present:
#smomrmlpara.SetHardware(1)
smowidget.onApply()
ms.selectModule('AstroVolume')
# Setting maximum quality for the rendering
astrovolumewidget = slicer.modules.astrovolume.widgetRepresentation()
astrovolumewidget.onCurrentQualityControlChanged(1)
volumes = slicer.mrmlScene.GetNodesByClass("vtkMRMLAstroVolumeNode")
volumefiltered = volumes.GetItemAsObject(1)
smomrmlpara.SetInputVolumeNodeID(volumefiltered.GetID())
astrovolumewidget.onCurrentQualityControlChanged(1)
# Create videos
ms.selectModule('ScreenCapture')
screencapturewidget = slicer.modules.screencapture.widgetRepresentation()
instance = screencapturewidget.self()
viewNode = slicer.util.getNode('vtkMRMLViewNode1')
instance.viewNodeSelector.setCurrentNode(viewNode)
instance.numberOfStepsSliderWidget.setValue(360)
instance.videoExportCheckBox.setChecked(1)
instance.videoFormatWidget.setCurrentIndex(1)
instance.videoFileNameWidget.setText("WEIN069.mp4")
instance.videoLengthSliderWidget.setValue(6)
instance.onCaptureButton()
viewNode = slicer.util.getNode('vtkMRMLViewNode2')
instance.viewNodeSelector.setCurrentNode(viewNode)
instance.viewNodeSelector.setCurrentNode(viewNode)
instance.numberOfStepsSliderWidget.setValue(360)
instance.videoExportCheckBox.setChecked(1)
instance.videoFormatWidget.setCurrentIndex(1)
instance.videoFileNameWidget.setText("WEIN069_smoothed.mp4")
instance.videoLengthSliderWidget.setValue(6)
instance.onCaptureButton()- Create(alike)MomentMap.py:
# Get the data-cube volume
volumeNode = getNode('name of the object')
datacube = volumeNode.GetImageData()
# Get dimensions
N1 = int(volumeNode.GetAttribute("SlicerAstro.NAXIS1"))
N2 = int(volumeNode.GetAttribute("SlicerAstro.NAXIS2"))
RMS = float(volumeNode.GetAttribute("SlicerAstro.RMS"))
# Create an empty 2-D image
imageSize = [N1, N2, 1]
imageSpacing = [1.0, 1.0, 1.0]
voxelType = vtk.VTK_FLOAT
imageDataTemp = vtk.vtkImageData()
imageDataTemp.SetDimensions(imageSize)
imageDataTemp.AllocateScalars(voxelType, 1)
extentTemp = imageDataTemp.GetExtent()
for i in xrange(extentTemp[0], extentTemp[1]+1):
for j in xrange(extentTemp[2], extentTemp[3]+1):
for k in xrange(extentTemp[4], extentTemp[5]+1):
imageDataTemp.SetScalarComponentFromFloat(i,j,k,0,0.)
# calculate moment map
imageData = volumeNode.GetImageData()
extent = imageData.GetExtent()
for i in xrange(extent[0], extent[1]+1):
for j in xrange(extent[2], extent[3]+1):
sum = 0.
for k in xrange(extent[4], extent[5]+1):
value = imageData.GetScalarComponentAsFloat(i,j,k,0)
if value > 3 * RMS:
sum += imageData.GetScalarComponentAsFloat(i,j,k,0)
imageDataTemp.SetScalarComponentFromFloat(i,j,0,0,sum)
imageDataTemp.Modified()
point = imageDataTemp.GetPointData()
array = piont.GetArray("ImageScalars")
point.Modified()
array.Modified()
array.GetValueRange()
# create Astro Volume for the moment map
astroVolumeLogic = slicer.modules.astrovolume.logic()
volumeNodeMomentMap = astroVolumeLogic.CloneVolume(slicer.mrmlScene, volumeNode, 'MomentMap')
# modify fits attributes
volumeNodeMomentMap.SetAttribute("SlicerAstro.NAXIS", "2")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.NAXIS3")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.CROTA3")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.CRPIX3")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.CRVAL3")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.CTYPE3")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.CUNIT3")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.DTYPE3")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.DRVAL3")
volumeNodeMomentMap.RemoveAttribute("SlicerAstro.DUNIT3")
# copy 2-D image into the Astro Volume object
volumeNodeMomentMap.SetAndObserveImageData(imageDataTemp)
volumeNodeMomentMap.UpdateNoiseAttributes()
volumeNodeMomentMap.UpdateRangeAttributes()
# change colorMap of the 2-D image
displayNode = volumeNodeMomentMap.GetDisplayNode()
displayNode.SetAndObserveColorNodeID('vtkMRMLColorTableNodeRainbow')
# changing the colorMap parameters
#displayNode.AutoWindowLevelOff()
#displayNode.SetWindow(??)
#displayNode.SetLevel(??)
run as: ./Slicer --python-script SmoothRenderSaveVideos.py or copy and paste in the python console
more to come...
Quick Links: Home • Download • SlicerAstro Roadmap • Tutorial • 3DSlicer User Manual • SlicerAstro User Manual • Python Interactor • Developer Manual
![]()