Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): type fixes #1638

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Corners } from '@kitware/vtk.js/Interaction/Widgets/OrientationMarkerWi
import type { IColorMapPreset } from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps';
import type { mat3 } from 'gl-matrix';
import { mat4 } from 'gl-matrix';
import { PixelDataTypedArray as PixelDataTypedArray_2 } from 'packages/core/dist/esm/types';
import type { Range as Range_2 } from '@kitware/vtk.js/types';
import { vec3 } from 'gl-matrix';
import type vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
Expand Down Expand Up @@ -2464,23 +2463,14 @@ declare namespace EventTypes_2 {
function extend2DBoundingBoxInViewAxis(boundsIJK: [Types_2.Point2, Types_2.Point2, Types_2.Point2], numSlicesToProject: number): [Types_2.Point2, Types_2.Point2, Types_2.Point2];

// @public (undocumented)
function extractWindowLevelRegionToolData(viewport: any): {
scalarData: PixelDataTypedArray_2;
function extractWindowLevelRegionToolData(viewport: Types_2.IVolumeViewport | Types_2.IStackViewport): {
scalarData: Types_2.PixelDataTypedArray;
minPixelValue: number;
maxPixelValue: number;
width: number;
height: number;
rows: number;
columns: number;
} | {
scalarData: any;
width: any;
height: any;
minPixelValue: number;
maxPixelValue: number;
rows: any;
columns: any;
color: any;
};

// @public (undocumented)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Types } from '@cornerstonejs/core';
import { getEnabledElementByViewportId } from '@cornerstonejs/core';
import { SegmentationRepresentations } from '../../../enums';

Expand All @@ -11,8 +12,8 @@ import { SegmentationRepresentations } from '../../../enums';
function getActorEntry(
viewportId: string,
segmentationId: string,
filterFn: (actor: unknown) => boolean
) {
filterFn: (actor: Types.ActorEntry) => boolean
): Types.ActorEntry | undefined {
const enabledElement = getEnabledElementByViewportId(viewportId);

if (!enabledElement) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import type { Types } from '@cornerstonejs/core';
import {
VolumeViewport,
utilities as csUtils,
cache,
StackViewport,
VolumeViewport,
} from '@cornerstonejs/core';

function extractWindowLevelRegionToolData(viewport) {
function extractWindowLevelRegionToolData(
viewport: Types.IVolumeViewport | Types.IStackViewport
) {
if (viewport instanceof VolumeViewport) {
return extractImageDataVolume(viewport);
}
Expand All @@ -16,7 +18,7 @@ function extractWindowLevelRegionToolData(viewport) {
throw new Error('Viewport not supported');
}

function extractImageDataVolume(viewport) {
function extractImageDataVolume(viewport: Types.IVolumeViewport) {
const { scalarData, width, height } =
csUtils.getCurrentVolumeViewportSlice(viewport);
const { min: minPixelValue, max: maxPixelValue } =
Expand All @@ -33,7 +35,7 @@ function extractImageDataVolume(viewport) {
};
}

function extractImageDataStack(viewport) {
function extractImageDataStack(viewport: Types.IStackViewport) {
const imageData = viewport.getImageData();
const { scalarData } = imageData;
const { min: minPixelValue, max: maxPixelValue } =
Expand Down
Loading