Difference between revisions of "Documentation/Nightly/Modules/Volumes"

From Slicer Wiki
Jump to: navigation, search
(Convert scalar volume to labelmap how-to)
(Replaced content with "<noinclude>{{documentation/versioncheck}} </noinclude> {{documentation/banner | text = [https://slicer.readthedocs.io/en/latest/user_guide/modules/volumes.html This page...")
Tags: 2017 source edit, Replaced
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>{{documentation/versioncheck}}</noinclude>
+
<noinclude>{{documentation/versioncheck}}
<!-- ---------------------------- -->
+
</noinclude>
{{documentation/{{documentation/version}}/module-header}}
 
<!-- ---------------------------- -->
 
  
<!-- ---------------------------- -->
+
{{documentation/banner
{{documentation/{{documentation/version}}/module-section|Introduction and Acknowledgements}}
+
| text = [https://slicer.readthedocs.io/en/latest/user_guide/modules/volumes.html This page has been moved to read-the-docs.]
{{documentation/{{documentation/version}}/module-introduction-start|{{documentation/modulename}} }}
+
| background-color = 8FBC8F }}
{{documentation/{{documentation/version}}/module-introduction-row}}
 
{{documentation/{{documentation/version}}/module-acknowledgements}}
 
: '''Contact:''' Steve Pieper, <email>pieper@bwh.harvard.edu</email><br>
 
{{documentation/{{documentation/version}}/module-introduction-row}}
 
{{documentation/{{documentation/version}}/module-introduction-logo-gallery
 
|{{collaborator|logo|isomics}}|{{collaborator|longname|isomics}}
 
|{{collaborator|logo|kitware}}|{{collaborator|longname|kitware}}
 
|{{collaborator|logo|namic}}|{{collaborator|longname|namic}}
 
|{{collaborator|logo|spl}}|{{collaborator|longname|spl}}
 
}}
 
{{documentation/{{documentation/version}}/module-introduction-end}}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Module Description}}
 
{{documentation/{{documentation/version}}/module-description}}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Use Cases}}
 
# Examples:
 
## Use the SampleData module to load the MR Head volume. You can control the scalar display options using this module.
 
## Use the SampleData module to download the DTI Head volume.  A tensor-specific display interface will allow you to display a variety of scalar modes and display glyphs.
 
# FAQ:
 
## [[Documentation/{{documentation/version}}/FAQ#How_to_overlay_2_volumes.3F|How to overlay 2 volumes?]]
 
## [[Documentation/{{documentation/version}}/FAQ#How_to_load_data_from_a_sequence_of_jpg_files.3F|How to load data from a sequence of JPG files?]]
 
# When loading a 2D image(jpg, png, tiff ...), the window level(colors) might be skewed. To see the original colors switch the ''Window Level'' combobox to '''Manual Min/Max''', then set ''Min'' to '''0''' and ''Max'' to '''255'''.
 
## Also use the Spacing field to enter the volumetric pixel sizes of the image data.
 
## While you can display color volumes as slices, most slicer modules do not work natively with RGB or RGBA data, the new [http://slicer.org/doc/html/VectorToScalarVolume_8py_source.html VectorToScalarVolume] converter can be used to create a volume for use, for example, with the Editor. (added post-4.1).
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Tutorials}}
 
 
 
* Tutorial about [http://wiki.na-mic.org/Wiki/index.php/Slicer3:Training loading and viewing data].  
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Panels and their use}}
 
 
 
{|
 
| rowspan=2 | {{documentation/{{documentation/version}}/module-parametersdescription}}
 
| [[Image:VolumesModule-2011-11-25.png|400px]]  Greyscale volume
 
|-
 
| [[image:VolumesModule-LabelMapDisplay-2015-05-05.png|400px]] Label map volume display
 
|}
 
 
 
 
 
{|
 
|[[Image:VolumesModuleWindowLevelSliderPopup.gif|frame|On mouse over, a second popup appears under the window level double slider. Large dynamic range can be controlled using the slider. Moving the handles of the popup double slider changes the whole range of the window level double slider.]]
 
|}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|How to}}
 
 
 
* '''Convert scalar volume to labelmap'''
 
:# Load it as labelmap in the first place: In the 'Add data into the scene' dialog check 'Show Options' and enable the option named 'LabelMap'. When OK is clicked, the volume is loaded as a labelmap.
 
:# Convert to labelmap using Cast Scalar Volume module. Select scalar volume as input, and create output by selecting 'Create new LabelMapVolume [as...]'. Output type is typically UnsignedChar.
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Similar Modules}}
 
* Each displayable type has a similar visualization control interface (for example, the Models, Tractography, Annotations...):
 
** [[Documentation/{{documentation/version}}/Modules/Models|Models]]: control the models/surfaces
 
** [[Documentation/{{documentation/version}}/Modules/Annotations|Annotations]]: control the annotations
 
* [[Documentation/{{documentation/version}}/Modules/VolumeRendering|Volume Rendering]]: volume render in the 3D view(s).
 
* Extensions
 
** [[Documentation/{{documentation/version}}/Modules/ImageMaker|Image Maker]]: create a volume from scratch.
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|References}}
 
N/A
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Information for Developers}}
 
{{documentation/{{documentation/version}}/module-developerinfo}}
 
===How to create a volume node from scratch? ===
 
You need to create a vtkImageData, a vtkMRMLScalarVolumeNode and a vtkMRMLScalarVolumeDisplayNode.
 
 
 
In C++:
 
<pre>
 
vtkNew<vtkImageData> imageData;
 
imageData->SetDimensions(10,10,10);
 
imageData->AllocateScalars(VTK_UNSIGNED_CHAR, 1);
 
// initialize the pixels here.
 
 
 
vtkNew<vtkMRMLScalarVolumeNode> volumeNode;
 
volumeNode->SetAndObserveImageData(imageData);
 
volumeNode->SetOrigin( -10., -10., -10.);
 
volumeNode->SetSpacing( 2., 2., 2. );
 
mrmlScene->AddNode( volumeNode.GetPointer() );
 
 
 
vtkNew<vtkMRMLScalarVolumeDisplayNode> displayNode;
 
mrmlScene->AddNode( displayNode.GetPointer() );
 
volumeNode->SetAndObserveDisplayNodeID(displayNode->GetID());
 
</pre>
 
 
 
In Python:
 
<pre>
 
imageData = vtk.vtkImageData()
 
imageData.SetDimensions(10,10,10)
 
imageData.AllocateScalars(vtk.VTK_UNSIGNED_CHAR, 1)
 
volumeNode = slicer.vtkMRMLScalarVolumeNode()
 
volumeNode.SetAndObserveImageData(imageData)
 
displayNode = slicer.vtkMRMLScalarVolumeDisplayNode()
 
slicer.mrmlScene.AddNode(volumeNode)
 
slicer.mrmlScene.AddNode(displayNode)
 
volumeNode.SetAndObserveDisplayNodeID(displayNode.GetID())
 
displayNode.SetAndObserveColorNodeID('vtkMRMLColorTableNodeGrey')
 
</pre>
 
 
 
Note that the origin and spacing must be set on the volume node instead of the image data.
 
The [[Documentation/{{documentation/version}}/Modules/ImageMaker|Image Maker]] extension module creates a volume from scratch.
 
 
 
===IO===
 
[[Documentation/{{documentation/version}}/SlicerApplication/SupportedDataFormat|Here]] is the list of supported file formats.
 
 
 
Important classes:
 
[http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/Modules/Loadable/Volumes/qSlicerVolumesIO.h?view=markup qSlicerVolumesIO].[h/cxx]]
 
[http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/Modules/Loadable/Volumes/Logic/vtkSlicerVolumesLogic.h?view=markup vtkSlicerVolumesLogic].[h/cxx]
 
[http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/Libs/MRML/Core/vtkMRMLVolumeArchetypeStorageNode.h?view=markup vtkMRMLVolumeArchetypeStorageNode].[h/cxx]
 
 
 
The following options can be passed to load volumes programmatically:
 
{|
 
|-
 
! Option
 
! Type
 
! Default
 
! Description
 
|-
 
| labelmap
 
| bool
 
| false
 
| Mark the volume a label map
 
|-
 
| center
 
| bool
 
| false
 
| Discard file origin information and move the center of the volume in 0,0,0
 
|-
 
| singleFile
 
| bool
 
| false
 
| Load the file as part of a series of 2D files that represent a 3D volume
 
|-
 
| autoWindowLevel
 
| bool
 
| true
 
| Automatically compute the window level based on the volume pixel intensities
 
|-
 
| discardOrientation
 
| bool
 
| false
 
| Discard file orientation information
 
|}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-footer}}
 
<!-- ---------------------------- -->
 

Latest revision as of 16:42, 21 August 2020

Home < Documentation < Nightly < Modules < Volumes