MCPcopy Create free account
hub / github.com/MITK/MITK / GenerateDataForRenderer

Method GenerateDataForRenderer

Modules/RT/src/mitkDoseImageVtkMapper2D.cpp:118–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118void mitk::DoseImageVtkMapper2D::GenerateDataForRenderer(mitk::BaseRenderer *renderer)
119{
120 LocalStorage *localStorage = m_LSH.GetLocalStorage(renderer);
121
122 mitk::Image *input = const_cast<mitk::Image *>(this->GetInput());
123 mitk::DataNode *datanode = this->GetDataNode();
124
125 if (input == nullptr || input->IsInitialized() == false)
126 {
127 return;
128 }
129
130 // check if there is a valid worldGeometry
131 const PlaneGeometry *worldGeometry = renderer->GetCurrentWorldPlaneGeometry();
132 if ((worldGeometry == nullptr) || (!worldGeometry->IsValid()) || (!worldGeometry->HasReferenceGeometry()))
133 {
134 return;
135 }
136
137 input->Update();
138
139 // early out if there is no intersection of the current rendering geometry
140 // and the geometry of the image that is to be rendered.
141 if (!RenderingGeometryIntersectsImage(worldGeometry, input->GetSlicedGeometry()))
142 {
143 // set image to nullptr, to clear the texture in 3D, because
144 // the latest image is used there if the plane is out of the geometry
145 // see bug-13275
146 localStorage->m_ReslicedImage = nullptr;
147 localStorage->m_Mapper->SetInputData(localStorage->m_EmptyPolyData);
148 return;
149 }
150
151 // set main input for ExtractSliceFilter
152 localStorage->m_Reslicer->SetInput(input);
153 localStorage->m_Reslicer->SetWorldGeometry(worldGeometry);
154 localStorage->m_Reslicer->SetTimeStep(this->GetTimestep());
155
156 // set the transformation of the image to adapt reslice axis
157 localStorage->m_Reslicer->SetResliceTransformByGeometry(
158 input->GetTimeGeometry()->GetGeometryForTimeStep(this->GetTimestep()));
159
160 // is the geometry of the slice based on the input image or the worldgeometry?
161 bool inPlaneResampleExtentByGeometry = false;
162 datanode->GetBoolProperty("in plane resample extent by geometry", inPlaneResampleExtentByGeometry, renderer);
163 localStorage->m_Reslicer->SetInPlaneResampleExtentByGeometry(inPlaneResampleExtentByGeometry);
164
165 // Initialize the interpolation mode for resampling; switch to nearest
166 // neighbor if the input image is too small.
167 if ((input->GetDimension() >= 3) && (input->GetDimension(2) > 1))
168 {
169 VtkResliceInterpolationProperty *resliceInterpolationProperty;
170 datanode->GetProperty(resliceInterpolationProperty, "reslice interpolation");
171
172 int interpolationMode = VTK_RESLICE_NEAREST;
173 if (resliceInterpolationProperty != nullptr)
174 {
175 interpolationMode = resliceInterpolationProperty->GetInterpolation();

Callers 1

UpdateMethod · 0.95

Calls 15

GetInputMethod · 0.95
ApplyOpacityMethod · 0.95
ApplyRenderingModeMethod · 0.95
TransformActorMethod · 0.95
GeneratePlaneMethod · 0.95
GetSlicedGeometryMethod · 0.80
GetNumberOfComponentsMethod · 0.80
GetValueAsIdMethod · 0.80
NormalizeMethod · 0.80
GetClippedPlaneBoundsMethod · 0.80
GetOutputSpacingMethod · 0.80

Tested by

no test coverage detected