Skip to content

Commit bf98788

Browse files
committed
refactor: move the updatedExtent API to properties
BREAKING CHANGE: the updatedExtent API has been moved from the mappers to the vtkImageProperty and vtkVolumeProperty interfaces. vtkImageMapper does not yet honor the updatedExtent API.
1 parent e735988 commit bf98788

File tree

14 files changed

+67
-87
lines changed

14 files changed

+67
-87
lines changed

Sources/Rendering/Core/ImageCPRMapper/index.d.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mat3, mat4, quat, vec3 } from 'gl-matrix';
2-
import { Extent, Nullable } from '../../../types';
2+
import { Nullable } from '../../../types';
33
import { vtkOutputPort } from '../../../interfaces';
44
import vtkAbstractMapper3D, {
55
IAbstractMapper3DInitialValues,
@@ -307,25 +307,6 @@ export interface vtkImageCPRMapper
307307
* @param imageData
308308
*/
309309
setImageConnection(imageData: vtkOutputPort): void;
310-
311-
/**
312-
* Tells the mapper to only update the specified extents.
313-
*
314-
* If there are zero extents, the mapper updates the entire volume texture.
315-
* Otherwise, the mapper will only update the texture by the specified extents
316-
* during the next render call.
317-
*
318-
* This array is cleared after a successful render.
319-
* @param extents
320-
*/
321-
setUpdatedExtents(extents: Extent[]): boolean;
322-
323-
/**
324-
* Retrieves the updated extents.
325-
*
326-
* This array is cleared after every successful render.
327-
*/
328-
getUpdatedExtents(): Extent[];
329310
}
330311

331312
/**

Sources/Rendering/Core/ImageCPRMapper/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ const defaultValues = (initialValues) => ({
344344
projectionSlabThickness: 1,
345345
projectionSlabNumberOfSamples: 1,
346346
projectionMode: ProjectionMode.MAX,
347-
updatedExtents: [],
348347
...initialValues,
349348
});
350349

@@ -376,7 +375,6 @@ export function extend(publicAPI, model, initialValues = {}) {
376375
'projectionSlabThickness',
377376
'projectionSlabNumberOfSamples',
378377
'projectionMode',
379-
'updatedExtents',
380378
]);
381379
CoincidentTopologyHelper.implementCoincidentTopologyMethods(publicAPI, model);
382380

Sources/Rendering/Core/ImageProperty/index.d.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { vtkObject } from '../../../interfaces';
2-
import { Nullable } from '../../../types';
2+
import { Extent, Nullable } from '../../../types';
33
import vtkColorTransferFunction from '../ColorTransferFunction';
44
import vtkPiecewiseFunction from '../../../Common/DataModel/PiecewiseFunction';
55
import { InterpolationType } from './Constants';
@@ -231,6 +231,25 @@ export interface vtkImageProperty extends vtkObject {
231231
* @param {Boolean} useLookupTableScalarRange
232232
*/
233233
setUseLookupTableScalarRange(useLookupTableScalarRange: boolean): boolean;
234+
235+
/**
236+
* Informs the mapper to only update the specified extents at the next render.
237+
*
238+
* If there are zero extents, the mapper updates the entire volume texture.
239+
* Otherwise, the mapper will only update the texture by the specified extents
240+
* during the next render call.
241+
*
242+
* This array is cleared after a successful render.
243+
* @param extents
244+
*/
245+
setUpdatedExtents(extents: Extent[]): boolean;
246+
247+
/**
248+
* Retrieves the updated extents.
249+
*
250+
* This array is cleared after every successful render.
251+
*/
252+
getUpdatedExtents(): Extent[];
234253
}
235254

236255
/**

Sources/Rendering/Core/ImageProperty/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function vtkImageProperty(publicAPI, model) {
130130
// ----------------------------------------------------------------------------
131131
// Object factory
132132
// ----------------------------------------------------------------------------
133-
const DEFAULT_VALUES = {
133+
const defaultValues = (initialValues) => ({
134134
independentComponents: false,
135135
interpolationType: InterpolationType.LINEAR,
136136
colorWindow: 255,
@@ -142,12 +142,14 @@ const DEFAULT_VALUES = {
142142
useLabelOutline: false,
143143
labelOutlineThickness: [1],
144144
labelOutlineOpacity: 1.0,
145-
};
145+
updatedExtents: [],
146+
...initialValues,
147+
});
146148

147149
// ----------------------------------------------------------------------------
148150

149151
export function extend(publicAPI, model, initialValues = {}) {
150-
Object.assign(model, DEFAULT_VALUES, initialValues);
152+
Object.assign(model, defaultValues(initialValues));
151153

152154
// Build VTK API
153155
macro.obj(publicAPI, model);
@@ -174,6 +176,7 @@ export function extend(publicAPI, model, initialValues = {}) {
174176
'useLookupTableScalarRange',
175177
'useLabelOutline',
176178
'labelOutlineOpacity',
179+
'updatedExtents',
177180
]);
178181

179182
macro.setGetArray(publicAPI, model, ['labelOutlineThickness']);

Sources/Rendering/Core/ImageResliceMapper/index.d.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import vtkAbstractImageMapper, {
33
} from '../AbstractImageMapper';
44
import vtkPlane from '../../../Common/DataModel/Plane';
55
import vtkPolyData from '../../../Common/DataModel/PolyData';
6-
import { Bounds, Extent } from '../../../types';
6+
import { Bounds } from '../../../types';
77
import { SlabTypes } from './Constants';
88
import CoincidentTopologyHelper, {
99
StaticCoincidentTopologyMethods,
@@ -115,25 +115,6 @@ export interface vtkImageResliceMapper
115115
* @param {vtkPolyData} slicePolyData The polydata to slice the volume with. Default: null
116116
*/
117117
setSlicePolyData(slicePolyData: vtkPolyData): boolean;
118-
119-
/**
120-
* Tells the mapper to only update the specified extents.
121-
*
122-
* If there are zero extents, the mapper updates the entire volume texture.
123-
* Otherwise, the mapper will only update the texture by the specified extents
124-
* during the next render call.
125-
*
126-
* This array is cleared after a successful render.
127-
* @param extents
128-
*/
129-
setUpdatedExtents(extents: Extent[]): boolean;
130-
131-
/**
132-
* Retrieves the updated extents.
133-
*
134-
* This array is cleared after every successful render.
135-
*/
136-
getUpdatedExtents(): Extent[];
137118
}
138119

139120
/**

Sources/Rendering/Core/ImageResliceMapper/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ const defaultValues = (initialValues) => ({
4545
slabType: SlabTypes.MEAN,
4646
slicePlane: null,
4747
slicePolyData: null,
48-
updatedExtents: [],
4948
...initialValues,
5049
});
5150

@@ -63,7 +62,6 @@ export function extend(publicAPI, model, initialValues = {}) {
6362
'slabType',
6463
'slicePlane',
6564
'slicePolyData',
66-
'updatedExtents',
6765
]);
6866
CoincidentTopologyHelper.implementCoincidentTopologyMethods(publicAPI, model);
6967

Sources/Rendering/Core/VolumeMapper/index.d.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import vtkPiecewiseFunction from '../../../Common/DataModel/PiecewiseFunction';
2-
import { Bounds, Extent } from '../../../types';
2+
import { Bounds } from '../../../types';
33
import vtkAbstractMapper3D, {
44
IAbstractMapper3DInitialValues,
55
} from '../AbstractMapper3D';
@@ -158,25 +158,6 @@ export interface vtkVolumeMapper extends vtkAbstractMapper3D {
158158
interactionSampleDistanceFactor: number
159159
): boolean;
160160

161-
/**
162-
* Tells the mapper to only update the specified extents.
163-
*
164-
* If there are zero extents, the mapper updates the entire volume texture.
165-
* Otherwise, the mapper will only update the texture by the specified extents
166-
* during the next render call.
167-
*
168-
* This array is cleared after a successful render.
169-
* @param extents
170-
*/
171-
setUpdatedExtents(extents: Extent[]): boolean;
172-
173-
/**
174-
* Retrieves the updated extents.
175-
*
176-
* This array is cleared after every successful render.
177-
*/
178-
getUpdatedExtents(): Extent[];
179-
180161
/**
181162
*
182163
*/

Sources/Rendering/Core/VolumeMapper/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ const defaultValues = (initialValues) => ({
148148
interactionSampleDistanceFactor: 1.0,
149149
blendMode: BlendMode.COMPOSITE_BLEND,
150150
volumeShadowSamplingDistFactor: 5.0,
151-
// TODO move to volumeProperty
152-
updatedExtents: [],
153151
colorTextureWidth: 1024,
154152
opacityTextureWidth: 1024,
155153
labelOutlineTextureWidth: 1024,
@@ -172,7 +170,6 @@ export function extend(publicAPI, model, initialValues = {}) {
172170
'interactionSampleDistanceFactor',
173171
'blendMode',
174172
'volumeShadowSamplingDistFactor',
175-
'updatedExtents',
176173
'colorTextureWidth',
177174
'opacityTextureWidth',
178175
'labelOutlineTextureWidth',

Sources/Rendering/Core/VolumeProperty/index.d.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import vtkPiecewiseFunction from '../../../Common/DataModel/PiecewiseFunction';
22
import { vtkObject } from '../../../interfaces';
3-
import { Nullable } from '../../../types';
3+
import { Extent, Nullable } from '../../../types';
44
import vtkColorTransferFunction from '../ColorTransferFunction';
55
import { ColorMixPreset, InterpolationType, OpacityMode } from './Constants';
66

@@ -486,6 +486,25 @@ export interface vtkVolumeProperty extends vtkObject {
486486
* @param LAOKernelRadius
487487
*/
488488
setLAOKernelRadius(LAOKernelRadius: number): void;
489+
490+
/**
491+
* Informs the mapper to only update the specified extents at the next render.
492+
*
493+
* If there are zero extents, the mapper updates the entire volume texture.
494+
* Otherwise, the mapper will only update the texture by the specified extents
495+
* during the next render call.
496+
*
497+
* This array is cleared after a successful render.
498+
* @param extents
499+
*/
500+
setUpdatedExtents(extents: Extent[]): boolean;
501+
502+
/**
503+
* Retrieves the updated extents.
504+
*
505+
* This array is cleared after every successful render.
506+
*/
507+
getUpdatedExtents(): Extent[];
489508
}
490509

491510
/**

Sources/Rendering/Core/VolumeProperty/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function vtkVolumeProperty(publicAPI, model) {
286286
// Object factory
287287
// ----------------------------------------------------------------------------
288288

289-
const DEFAULT_VALUES = {
289+
const defaultValues = (initialValues) => ({
290290
colorMixPreset: ColorMixPreset.DEFAULT,
291291
independentComponents: true,
292292
interpolationType: InterpolationType.FAST_LINEAR,
@@ -312,12 +312,15 @@ const DEFAULT_VALUES = {
312312
localAmbientOcclusion: false,
313313
LAOKernelSize: 15,
314314
LAOKernelRadius: 7,
315-
};
315+
updatedExtents: [],
316+
317+
...initialValues,
318+
});
316319

317320
// ----------------------------------------------------------------------------
318321

319322
export function extend(publicAPI, model, initialValues = {}) {
320-
Object.assign(model, DEFAULT_VALUES, initialValues);
323+
Object.assign(model, defaultValues(initialValues));
321324

322325
// Build VTK API
323326
macro.obj(publicAPI, model);
@@ -366,6 +369,7 @@ export function extend(publicAPI, model, initialValues = {}) {
366369
'localAmbientOcclusion',
367370
'LAOKernelSize',
368371
'LAOKernelRadius',
372+
'updatedExtents',
369373
]);
370374

371375
// Property moved from volume mapper

0 commit comments

Comments
 (0)