Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Christian Butz
VTK
Commits
f4ef870a
Commit
f4ef870a
authored
Oct 29, 2016
by
David E. DeMarle
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
4ada4f52
' into release
parents
e95e780f
4ada4f52
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
499 additions
and
52 deletions
+499
-52
Rendering/Core/vtkVolumeProperty.h
Rendering/Core/vtkVolumeProperty.h
+9
-0
Rendering/Volume/Testing/Cxx/CMakeLists.txt
Rendering/Volume/Testing/Cxx/CMakeLists.txt
+3
-0
Rendering/Volume/Testing/Cxx/TestGPURayCastBlendModes.cxx
Rendering/Volume/Testing/Cxx/TestGPURayCastBlendModes.cxx
+130
-0
Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsAdditive.cxx
...lume/Testing/Cxx/TestGPURayCastFourComponentsAdditive.cxx
+117
-0
Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsAverage.cxx
...olume/Testing/Cxx/TestGPURayCastFourComponentsAverage.cxx
+118
-0
Rendering/Volume/Testing/Data/Baseline/TestGPURayCastBlendModes.png.md5
...me/Testing/Data/Baseline/TestGPURayCastBlendModes.png.md5
+1
-0
Rendering/Volume/Testing/Data/Baseline/TestGPURayCastFourComponentsAdditive.png.md5
...ata/Baseline/TestGPURayCastFourComponentsAdditive.png.md5
+1
-0
Rendering/Volume/Testing/Data/Baseline/TestGPURayCastFourComponentsAverage.png.md5
...Data/Baseline/TestGPURayCastFourComponentsAverage.png.md5
+1
-0
Rendering/Volume/vtkFixedPointVolumeRayCastMapper.cxx
Rendering/Volume/vtkFixedPointVolumeRayCastMapper.cxx
+1
-2
Rendering/Volume/vtkVolumeMapper.h
Rendering/Volume/vtkVolumeMapper.h
+83
-12
Rendering/VolumeOpenGL/vtkOpenGLGPUVolumeRayCastMapper.cxx
Rendering/VolumeOpenGL/vtkOpenGLGPUVolumeRayCastMapper.cxx
+11
-0
Rendering/VolumeOpenGL2/vtkVolumeShaderComposer.h
Rendering/VolumeOpenGL2/vtkVolumeShaderComposer.h
+24
-38
No files found.
Rendering/Core/vtkVolumeProperty.h
View file @
f4ef870a
...
...
@@ -262,6 +262,15 @@ public:
* of mapper, turning shading off is generally the same as setting
* ambient=1, diffuse=0, specular=0. Shading can be independently
* turned on/off per component.
*
* \note Shading is \b only supported for vtkVolumeMapper::COMPOSITE_BLEND.
* For minimum and maximum intensity blend modes, there is not necessarily one
* unique location along the ray through the volume where that minimum or
* maximum occurs. For average and additive blend modes, the value being
* visualized does not represent a location in the volume but rather a
* statistical measurement along the ray traversing through the volume, and
* hence shading is not applicable.
* \sa vtkVolumeMapper::BlendModes
*/
void
SetShade
(
int
index
,
int
value
);
void
SetShade
(
int
value
)
...
...
Rendering/Volume/Testing/Cxx/CMakeLists.txt
View file @
f4ef870a
...
...
@@ -53,6 +53,7 @@ endif()
# These tests are only built for the OpenGL2 backend
set
(
VolumeOpenGL2CxxTests
TestGPURayCastBlendModes.cxx
TestGPURayCastAverageIP.cxx
TestGPURayCastCameraInside.cxx
TestGPURayCastCameraInsideSmallSpacing.cxx
...
...
@@ -62,6 +63,8 @@ set (VolumeOpenGL2CxxTests
TestGPURayCastClippingPolyData.cxx
TestGPURayCastClippingUserTransform.cxx
TestGPURayCastDependentComponentsLightParameters.cxx
TestGPURayCastFourComponentsAdditive.cxx
TestGPURayCastFourComponentsAverage.cxx
TestGPURayCastFourComponentsDependentGradient.cxx
TestGPURayCastGradientOpacity.cxx
TestGPURayCastGradientOpacityLight.cxx
...
...
Rendering/Volume/Testing/Cxx/TestGPURayCastBlendModes.cxx
0 → 100644
View file @
f4ef870a
/*=========================================================================
Program: Visualization Toolkit
Module: TestGPURayCastBlendModes.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// Description
// This test renders a simple cube volume using different blend modes
#include "vtkCamera.h"
#include "vtkColorTransferFunction.h"
#include "vtkGPUVolumeRayCastMapper.h"
#include "vtkImageData.h"
#include "vtkNew.h"
#include "vtkPiecewiseFunction.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkVolume.h"
#include "vtkVolumeProperty.h"
int
TestGPURayCastBlendModes
(
int
argc
,
char
*
argv
[])
{
cout
<<
"CTEST_FULL_OUTPUT (Avoid ctest truncation of output)"
<<
endl
;
int
dims
[
3
]
=
{
100
,
100
,
100
};
int
boundary
[
3
]
=
{
10
,
10
,
10
};
// Create a vtkImageData with two components
vtkNew
<
vtkImageData
>
image
;
image
->
SetDimensions
(
dims
[
0
],
dims
[
1
],
dims
[
2
]);
image
->
AllocateScalars
(
VTK_UNSIGNED_CHAR
,
1
);
// Fill the first half rectangular parallelopiped along X with the
// first component values and the second half with second component values
unsigned
char
*
ptr
=
static_cast
<
unsigned
char
*>
(
image
->
GetScalarPointer
(
0
,
0
,
0
));
for
(
int
z
=
0
;
z
<
dims
[
2
];
++
z
)
{
for
(
int
y
=
0
;
y
<
dims
[
1
];
++
y
)
{
for
(
int
x
=
0
;
x
<
dims
[
0
];
++
x
)
{
if
((
z
<
boundary
[
2
]
||
z
>
(
dims
[
2
]
-
boundary
[
2
]
-
1
))
||
(
y
<
boundary
[
1
]
||
y
>
(
dims
[
1
]
-
boundary
[
1
]
-
1
))
||
(
x
<
boundary
[
0
]
||
x
>
(
dims
[
0
]
-
boundary
[
0
]
-
1
)))
{
*
ptr
++
=
255
;
}
else
{
*
ptr
++
=
0
;
}
}
}
}
vtkNew
<
vtkColorTransferFunction
>
color
;
color
->
AddRGBPoint
(
0.0
,
0.2
,
0.3
,
0.6
);
color
->
AddRGBPoint
(
255.0
,
0.2
,
0.6
,
0.3
);
vtkNew
<
vtkPiecewiseFunction
>
opacity
;
opacity
->
AddPoint
(
0.0
,
0.0
);
opacity
->
AddPoint
(
255.0
,
0.8
);
vtkNew
<
vtkVolumeProperty
>
property
;
property
->
SetScalarOpacity
(
opacity
.
GetPointer
());
property
->
SetColor
(
color
.
GetPointer
());
vtkNew
<
vtkVolume
>
volume
[
4
];
vtkNew
<
vtkGPUVolumeRayCastMapper
>
mapper
[
4
];
mapper
[
0
]
->
SetBlendModeToMaximumIntensity
();
mapper
[
1
]
->
SetBlendModeToMinimumIntensity
();
mapper
[
2
]
->
SetBlendModeToAdditive
();
mapper
[
3
]
->
SetBlendModeToAverageIntensity
();
vtkNew
<
vtkRenderWindow
>
renWin
;
renWin
->
SetMultiSamples
(
0
);
renWin
->
SetSize
(
301
,
300
);
// Intentional NPOT size
vtkNew
<
vtkRenderer
>
renderer
[
4
];
renderer
[
0
]
->
SetViewport
(
0.0
,
0.0
,
0.5
,
0.5
);
renderer
[
1
]
->
SetViewport
(
0.5
,
0.0
,
1.0
,
0.5
);
renderer
[
2
]
->
SetViewport
(
0.0
,
0.5
,
0.5
,
1.0
);
renderer
[
3
]
->
SetViewport
(
0.5
,
0.5
,
1.0
,
1.0
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
mapper
[
i
]
->
SetInputData
(
image
.
GetPointer
());
volume
[
i
]
->
SetMapper
(
mapper
[
i
].
GetPointer
());
volume
[
i
]
->
SetProperty
(
property
.
GetPointer
());
renderer
[
i
]
->
AddVolume
(
volume
[
i
].
GetPointer
());
renderer
[
i
]
->
SetBackground
(
0.3
,
0.3
,
0.3
);
renderer
[
i
]
->
GetActiveCamera
()
->
Yaw
(
20.0
);
renderer
[
i
]
->
ResetCamera
();
renWin
->
AddRenderer
(
renderer
[
i
].
GetPointer
());
}
vtkNew
<
vtkRenderWindowInteractor
>
iren
;
iren
->
SetRenderWindow
(
renWin
.
GetPointer
());
renWin
->
Render
();
int
retVal
=
vtkTesting
::
Test
(
argc
,
argv
,
renWin
.
GetPointer
(),
15
);
if
(
retVal
==
vtkRegressionTester
::
DO_INTERACTOR
)
{
iren
->
Start
();
}
if
((
retVal
==
vtkTesting
::
PASSED
)
||
(
retVal
==
vtkTesting
::
DO_INTERACTOR
))
{
return
EXIT_SUCCESS
;
}
else
{
return
EXIT_FAILURE
;
}
}
Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsAdditive.cxx
0 → 100644
View file @
f4ef870a
/*=========================================================================
Program: Visualization Toolkit
Module: TestGPURayCastFourComponentsAdditive.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// This test volume renders the vase dataset with 4 dependent components
// using the additive projection method.
#include "vtkGPUVolumeRayCastMapper.h"
#include "vtkTestUtilities.h"
#include "vtkXMLImageDataReader.h"
#include "vtkImageShiftScale.h"
#include "vtkColorTransferFunction.h"
#include "vtkPiecewiseFunction.h"
#include "vtkTransform.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkVolumeProperty.h"
#include "vtkCamera.h"
#include "vtkRegressionTestImage.h"
int
TestGPURayCastFourComponentsAdditive
(
int
argc
,
char
*
argv
[])
{
cout
<<
"CTEST_FULL_OUTPUT (Avoid ctest truncation of output)"
<<
endl
;
char
*
cfname
=
vtkTestUtilities
::
ExpandDataFileName
(
argc
,
argv
,
"Data/vase_4comp.vti"
);
vtkXMLImageDataReader
*
reader
=
vtkXMLImageDataReader
::
New
();
reader
->
SetFileName
(
cfname
);
delete
[]
cfname
;
vtkRenderer
*
ren1
=
vtkRenderer
::
New
();
vtkRenderWindow
*
renWin
=
vtkRenderWindow
::
New
();
renWin
->
AddRenderer
(
ren1
);
renWin
->
SetSize
(
301
,
300
);
vtkRenderWindowInteractor
*
iren
=
vtkRenderWindowInteractor
::
New
();
iren
->
SetRenderWindow
(
renWin
);
renWin
->
Render
();
vtkGPUVolumeRayCastMapper
*
volumeMapper
;
vtkVolumeProperty
*
volumeProperty
;
vtkVolume
*
volume
;
volumeMapper
=
vtkGPUVolumeRayCastMapper
::
New
();
volumeMapper
->
SetBlendModeToAdditive
();
volumeMapper
->
SetInputConnection
(
reader
->
GetOutputPort
());
volumeProperty
=
vtkVolumeProperty
::
New
();
volumeProperty
->
IndependentComponentsOff
();
volumeProperty
->
SetInterpolationType
(
VTK_LINEAR_INTERPOLATION
);
volumeProperty
->
SetShade
(
1
);
vtkPiecewiseFunction
*
f
=
vtkPiecewiseFunction
::
New
();
f
->
AddPoint
(
0
,
0.0
);
f
->
AddPoint
(
255
,
0.1
);
volumeProperty
->
SetScalarOpacity
(
f
);
f
->
Delete
();
volume
=
vtkVolume
::
New
();
volume
->
SetMapper
(
volumeMapper
);
volume
->
SetProperty
(
volumeProperty
);
ren1
->
AddViewProp
(
volume
);
int
valid
=
volumeMapper
->
IsRenderSupported
(
renWin
,
volumeProperty
);
int
retVal
;
if
(
valid
)
{
iren
->
Initialize
();
ren1
->
SetBackground
(
0.1
,
0.4
,
0.2
);
ren1
->
ResetCamera
();
renWin
->
Render
();
retVal
=
vtkTesting
::
Test
(
argc
,
argv
,
renWin
,
75
);
if
(
retVal
==
vtkRegressionTester
::
DO_INTERACTOR
)
{
iren
->
Start
();
}
}
else
{
retVal
=
vtkTesting
::
PASSED
;
cout
<<
"Required extensions not supported."
<<
endl
;
}
iren
->
Delete
();
renWin
->
Delete
();
ren1
->
Delete
();
volumeMapper
->
Delete
();
volumeProperty
->
Delete
();
volume
->
Delete
();
reader
->
Delete
();
if
((
retVal
==
vtkTesting
::
PASSED
)
||
(
retVal
==
vtkTesting
::
DO_INTERACTOR
))
{
return
0
;
}
else
{
return
1
;
}
}
Rendering/Volume/Testing/Cxx/TestGPURayCastFourComponentsAverage.cxx
0 → 100644
View file @
f4ef870a
/*=========================================================================
Program: Visualization Toolkit
Module: TestGPURayCastFourComponentsAverage.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// This test volume renders the vase dataset with 4 dependent components
// using the average intensity projection method.
#include "vtkGPUVolumeRayCastMapper.h"
#include "vtkTestUtilities.h"
#include "vtkXMLImageDataReader.h"
#include "vtkImageShiftScale.h"
#include "vtkColorTransferFunction.h"
#include "vtkPiecewiseFunction.h"
#include "vtkTransform.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkVolumeProperty.h"
#include "vtkCamera.h"
#include "vtkRegressionTestImage.h"
int
TestGPURayCastFourComponentsAverage
(
int
argc
,
char
*
argv
[])
{
cout
<<
"CTEST_FULL_OUTPUT (Avoid ctest truncation of output)"
<<
endl
;
char
*
cfname
=
vtkTestUtilities
::
ExpandDataFileName
(
argc
,
argv
,
"Data/vase_4comp.vti"
);
vtkXMLImageDataReader
*
reader
=
vtkXMLImageDataReader
::
New
();
reader
->
SetFileName
(
cfname
);
delete
[]
cfname
;
vtkRenderer
*
ren1
=
vtkRenderer
::
New
();
vtkRenderWindow
*
renWin
=
vtkRenderWindow
::
New
();
renWin
->
AddRenderer
(
ren1
);
renWin
->
SetSize
(
301
,
300
);
vtkRenderWindowInteractor
*
iren
=
vtkRenderWindowInteractor
::
New
();
iren
->
SetRenderWindow
(
renWin
);
renWin
->
Render
();
vtkGPUVolumeRayCastMapper
*
volumeMapper
;
vtkVolumeProperty
*
volumeProperty
;
vtkVolume
*
volume
;
volumeMapper
=
vtkGPUVolumeRayCastMapper
::
New
();
volumeMapper
->
SetBlendModeToAverageIntensity
();
volumeMapper
->
SetAverageIPScalarRange
(
20
,
300
);
volumeMapper
->
SetInputConnection
(
reader
->
GetOutputPort
());
volumeProperty
=
vtkVolumeProperty
::
New
();
volumeProperty
->
IndependentComponentsOff
();
volumeProperty
->
SetInterpolationType
(
VTK_LINEAR_INTERPOLATION
);
volumeProperty
->
SetShade
(
1
);
vtkPiecewiseFunction
*
f
=
vtkPiecewiseFunction
::
New
();
f
->
AddPoint
(
0
,
0.0
);
f
->
AddPoint
(
255
,
1.0
);
volumeProperty
->
SetScalarOpacity
(
f
);
f
->
Delete
();
volume
=
vtkVolume
::
New
();
volume
->
SetMapper
(
volumeMapper
);
volume
->
SetProperty
(
volumeProperty
);
ren1
->
AddViewProp
(
volume
);
int
valid
=
volumeMapper
->
IsRenderSupported
(
renWin
,
volumeProperty
);
int
retVal
;
if
(
valid
)
{
iren
->
Initialize
();
ren1
->
SetBackground
(
0.1
,
0.4
,
0.2
);
ren1
->
ResetCamera
();
renWin
->
Render
();
retVal
=
vtkTesting
::
Test
(
argc
,
argv
,
renWin
,
10
);
if
(
retVal
==
vtkRegressionTester
::
DO_INTERACTOR
)
{
iren
->
Start
();
}
}
else
{
retVal
=
vtkTesting
::
PASSED
;
cout
<<
"Required extensions not supported."
<<
endl
;
}
iren
->
Delete
();
renWin
->
Delete
();
ren1
->
Delete
();
volumeMapper
->
Delete
();
volumeProperty
->
Delete
();
volume
->
Delete
();
reader
->
Delete
();
if
((
retVal
==
vtkTesting
::
PASSED
)
||
(
retVal
==
vtkTesting
::
DO_INTERACTOR
))
{
return
0
;
}
else
{
return
1
;
}
}
Rendering/Volume/Testing/Data/Baseline/TestGPURayCastBlendModes.png.md5
0 → 100644
View file @
f4ef870a
0b59cdaf0ae5456d18f1126966a0e37d
Rendering/Volume/Testing/Data/Baseline/TestGPURayCastFourComponentsAdditive.png.md5
0 → 100644
View file @
f4ef870a
babe6a0b54fa2c2f6caa168e472db58b
Rendering/Volume/Testing/Data/Baseline/TestGPURayCastFourComponentsAverage.png.md5
0 → 100644
View file @
f4ef870a
8b55cd7ee523178d7df845b47b8eee2e
Rendering/Volume/vtkFixedPointVolumeRayCastMapper.cxx
View file @
f4ef870a
...
...
@@ -1480,11 +1480,10 @@ void vtkFixedPointVolumeRayCastMapper::Render( vtkRenderer *ren, vtkVolume *vol
if
(
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
COMPOSITE_BLEND
&&
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
MAXIMUM_INTENSITY_BLEND
&&
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
MINIMUM_INTENSITY_BLEND
&&
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
AVERAGE_INTENSITY_BLEND
&&
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
ADDITIVE_BLEND
)
{
vtkErrorMacro
(
<<
"Selected blend mode not supported. "
<<
"Only Composite, MIP, MinIP
, averageIP
and additive modes "
<<
"Only Composite, MIP, MinIP and additive modes "
<<
"are supported by the fixed point implementation."
);
return
;
}
...
...
Rendering/Volume/vtkVolumeMapper.h
View file @
f4ef870a
...
...
@@ -61,10 +61,40 @@ public:
//@{
/**
* Set/Get the blend mode.
* Additive blend mode adds scalars along the ray and multiply them by
* their opacity mapping value.
* Average blend mode averages scalars and determines the final color by
* passing the average through the color and opacity transfer functions.
* The default mode is Composite where the scalar values are sampled through
* the volume and composited in a front-to-back scheme through alpha blending.
* The final color and opacity is determined using the color and opacity
* transfer functions.
*
* Maximum and minimum intensity blend modes use the maximum and minimum
* scalar values, respectively, along the sampling ray. The final color and
* opacity is determined by passing the resultant value through the color and
* opacity transfer functions.
*
* Additive blend mode accumulates scalar values by passing each value through
* the opacity transfer function and then adding up the product of the value
* and its opacity. In other words, the scalar values are scaled using the
* opacity transfer function and summed to derive the final color. Note that
* the resulting image is always grayscale i.e. aggregated values are not
* passed through the color transfer function. This is because the final
* value is a derived value and not a real data value along the sampling ray.
*
* Average intensity blend mode works similar to the additive blend mode where
* the scalar values are multiplied by opacity calculated from the opacity
* transfer function and then added. The additional step here is to
* divide the sum by the number of samples taken through the volume.
* One can control the scalar range by setting the AverageIPScalarRange ivar
* to disregard scalar values, not in the range of interest, from the average
* computation.
* As is the case with the additive intensity projection, the final
* image will always be grayscale i.e. the aggregated values are not
* passed through the color transfer function. This is because the
* resultant value is a derived value and not a real data value along
* the sampling ray.
*
* \note vtkVolumeMapper::AVERAGE_INTENSITY_BLEND is only supported by the
* vtkGPUVolumeRayCastMapper with the OpenGL2 backend.
* \sa SetAverageIPScalarRange()
*/
vtkSetMacro
(
BlendMode
,
int
);
void
SetBlendModeToComposite
()
...
...
@@ -162,7 +192,40 @@ public:
*/
virtual
void
ReleaseGraphicsResources
(
vtkWindow
*
)
{}
enum
/**
* Blend modes.
* The default mode is Composite where the scalar values are sampled through
* the volume and composited in a front-to-back scheme through alpha blending.
* The final color and opacity is determined using the color and opacity
* transfer functions.
*
* Maximum and minimum intensity blend modes use the maximum and minimum
* scalar values, respectively, along the sampling ray. The final color and
* opacity is determined by passing the resultant value through the color and
* opacity transfer functions.
*
* Additive blend mode accumulates scalar values by passing each value through
* the opacity transfer function and then adding up the product of the value
* and its opacity. In other words, the scalar values are scaled using the
* opacity transfer function and summed to derive the final color. Note that
* the resulting image is always grayscale i.e. aggregated values are not
* passed through the color transfer function. This is because the final
* value is a derived value and not a real data value along the sampling ray.
*
* Average intensity blend mode works similar to the additive blend mode where
* the scalar values are multiplied by opacity calculated from the opacity
* transfer function and then added. The additional step here is to
* divide the sum by the number of samples taken through the volume.
* As is the case with the additive intensity projection, the final
* image will always be grayscale i.e. the aggregated values are not
* passed through the color transfer function. This is because the
* resultant value is a derived value and not a real data value along
* the sampling ray.
*
* \note vtkVolumeMapper::AVERAGE_INTENSITY_BLEND is only supported by the
* vtkGPUVolumeRayCastMapper with the OpenGL2 backend.
*/
enum
BlendModes
{
COMPOSITE_BLEND
,
MAXIMUM_INTENSITY_BLEND
,
...
...
@@ -175,24 +238,32 @@ protected:
vtkVolumeMapper
();
~
vtkVolumeMapper
();
// Compute a sample distance from the data spacing. When the number of
// voxels is 8, the sample distance will be roughly 1/200 the average voxel
// size. The distance will grow proportionally to numVoxels^(1/3).
/**
* Compute a sample distance from the data spacing. When the number of
* voxels is 8, the sample distance will be roughly 1/200 the average voxel
* size. The distance will grow proportionally to numVoxels^(1/3).
*/
double
SpacingAdjustedSampleDistance
(
double
inputSpacing
[
3
],
int
inputExtent
[
6
]);
int
inputExtent
[
6
]);
int
BlendMode
;
// Threshold range for average intensity projection
/**
* Threshold range for average intensity projection
*/
double
AverageIPScalarRange
[
2
];
// Cropping variables, and a method for converting the world
// coordinate cropping region planes to voxel coordinates
//@{
/**
* Cropping variables, and a method for converting the world
* coordinate cropping region planes to voxel coordinates
*/
int
Cropping
;
double
CroppingRegionPlanes
[
6
];
double
VoxelCroppingRegionPlanes
[
6
];
int
CroppingRegionFlags
;
void
ConvertCroppingRegionPlanesToVoxels
();
//@}
virtual
int
FillInputPortInformation
(
int
,
vtkInformation
*
);
...
...
Rendering/VolumeOpenGL/vtkOpenGLGPUVolumeRayCastMapper.cxx
View file @
f4ef870a
...
...
@@ -4209,6 +4209,17 @@ void vtkOpenGLGPUVolumeRayCastMapper::PreRender(vtkRenderer *ren,
int
shadeMethod
=
vtkOpenGLGPUVolumeRayCastMapperShadeNotUsed
;
int
componentMethod
=
vtkOpenGLGPUVolumeRayCastMapperComponentNotUsed
;
if
(
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
COMPOSITE_BLEND
&&
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
MAXIMUM_INTENSITY_BLEND
&&
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
MINIMUM_INTENSITY_BLEND
&&
this
->
GetBlendMode
()
!=
vtkVolumeMapper
::
ADDITIVE_BLEND
)
{
vtkErrorMacro
(
<<
"Selected blend mode not supported. "
<<
"Only Composite, MIP, MinIP and additive modes "
<<
"are supported by this implementation."
);
return
;
}
switch
(
this
->
BlendMode
)
{
case
vtkVolumeMapper
::
COMPOSITE_BLEND
:
...
...
Rendering/VolumeOpenGL2/vtkVolumeShaderComposer.h
View file @
f4ef870a
...
...
@@ -1177,8 +1177,7 @@ namespace vtkvolume
\n
if (in_averageIPRange.x <= intensity &&\
\n
intensity <= in_averageIPRange.y)\
\n
{\
\n
float opacity = computeOpacity(scalar, i);\
\n
l_avgValue[i] += scalar[i];\
\n
l_avgValue[i] += computeOpacity(scalar, i) * scalar[i];\
\n
++l_numSamples[i];\
\n
}\
\n
}"
...
...
@@ -1194,33 +1193,23 @@ namespace vtkvolume
\n
if (in_averageIPRange.x <= intensity &&\
\n
intensity <= in_averageIPRange.y)\
\n
{\
\n
l_avgValue.
w
+= scalar.x;\
\n
++l_numSamples.
w
;\
\n
l_avgValue.
x
+=
computeOpacity(scalar) *
scalar.x;\
\n
++l_numSamples.
x
;\
\n
}"
);
}
}
else
if
(
mapper
->
GetBlendMode
()
==
vtkVolumeMapper
::
ADDITIVE_BLEND
)
{
if
(
noOfComponents
>
1
)
if
(
noOfComponents
>
1
&&
independentComponents
)
{
if
(
!
independentComponents
)
{
shaderStr