Skip to content

Commit

Permalink
fix: camera position with new dynamic image data positoin
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi committed Apr 7, 2021
1 parent 6b170bd commit 34ad563
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 93 deletions.
20 changes: 10 additions & 10 deletions examples/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ function Index() {
'Example with twenty five on screen canvases linked to a single RenderingEngine.',
},
{
title: 'color',
title: 'Color',
url: '/color',
text: 'Example with color.',
},
{
title: '2D rendering with vtkVolumeMapper',
url: '/volumeMapper2D',
text: 'Example for displaying 2D image with vtkVolumeMapper.',
},
// {
// title: '2D rendering with vtkVolumeMapper',
// url: '/volumeMapper2D',
// text: 'Example for displaying 2D image with vtkVolumeMapper.',
// },
{
title: 'New stack viewport',
url: '/stackViewport',
Expand Down Expand Up @@ -115,9 +115,9 @@ function Example(props) {

function AppRouter() {
const mpr = () =>
Example({
children: <VTKMPRExample />,
})
Example({
children: <VTKMPRExample />,
})
const canvasResize = () =>
Example({
children: <CanvasResizeExample />,
Expand Down Expand Up @@ -150,7 +150,7 @@ function AppRouter() {
<Route exact path="/canvasResize/" render={canvasResize} />
<Route exact path="/twentyFiveCanvas/" render={twentyFiveCanvas} />
<Route exact path="/color/" render={color} />
<Route exact path="/volumeMapper2D/" render={volumeMapper2D} />
{/* <Route exact path="/volumeMapper2D/" render={volumeMapper2D} /> */}
<Route exact path="/stackViewport/" render={stackViewport} />
<Route exact component={Index} />
</Switch>
Expand Down
7 changes: 6 additions & 1 deletion examples/ExampleStackViewport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
VIEWPORT_TYPE,
EVENTS as RENDERING_EVENTS,
} from '@cornerstone'
import { SynchronizerManager, synchronizers } from '@cornerstone-tools'
import {
SynchronizerManager,
synchronizers,
ToolGroupManager,
} from '@cornerstone-tools'

import vtkColorTransferFunction from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction'
import vtkPiecewiseFunction from 'vtk.js/Sources/Common/DataModel/PiecewiseFunction'
Expand Down Expand Up @@ -316,6 +320,7 @@ class StackViewportExample extends Component {
// Destroy synchronizers
// SynchronizerManager.destroy()
cache.purgeCache()
ToolGroupManager.destroy()

this.renderingEngine.destroy()
}
Expand Down
4 changes: 2 additions & 2 deletions examples/ExampleTwentyFiveCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class TwentyFiveCanvasExample extends Component {
<div>
<div className="row">
<div className="col-xs-12">
<h1>Canvas Resize Example </h1>
<h1>Twenty Five Canvas </h1>
<p>
This example shows that it is possible to have 25 512x512 canvases
from one render engine. Each viewport in the rendering engine is
Expand All @@ -147,7 +147,7 @@ class TwentyFiveCanvasExample extends Component {
<div>{canvases}</div>
</div>
</div>
);
)
}
}

Expand Down
27 changes: 21 additions & 6 deletions examples/ExampleVTKMPR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {
createAndCacheVolume,
EVENTS as RENDERING_EVENTS,
} from '@cornerstone';
import { SynchronizerManager, synchronizers } from '@cornerstone-tools';
import {
SynchronizerManager,
synchronizers,
ToolGroupManager,
} from '@cornerstone-tools'

import vtkColorTransferFunction from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction';
import vtkPiecewiseFunction from 'vtk.js/Sources/Common/DataModel/PiecewiseFunction';
Expand All @@ -28,17 +32,15 @@ import {
} from './constants';
import LAYOUTS, { ptCtFusion, fourUpCT, petTypes, obliqueCT } from './layouts';

const {
ctSceneToolGroup,

let ctSceneToolGroup,
ptSceneToolGroup,
fusionSceneToolGroup,
ptMipSceneToolGroup,
ctVRSceneToolGroup,
ctObliqueToolGroup,
ptTypesSceneToolGroup,
} = initToolGroups();

const ptCtLayoutTools = ['Levels'].concat(PET_CT_ANNOTATION_TOOLS);
ptCtLayoutTools

class VTKMPRExample extends Component {
state = {
Expand Down Expand Up @@ -77,6 +79,18 @@ class VTKMPRExample extends Component {
constructor(props) {
super(props);

;({
ctSceneToolGroup,
ptSceneToolGroup,
fusionSceneToolGroup,
ptMipSceneToolGroup,
ctVRSceneToolGroup,
ctObliqueToolGroup,
ptTypesSceneToolGroup,
} = initToolGroups())

ptCtLayoutTools = ['Levels'].concat(PET_CT_ANNOTATION_TOOLS)

this._canvasNodes = new Map();
this._viewportGridRef = React.createRef();
this.swapPetTransferFunction = this.swapPetTransferFunction.bind(this);
Expand Down Expand Up @@ -258,6 +272,7 @@ class VTKMPRExample extends Component {
// Destroy synchronizers
SynchronizerManager.destroy();
cache.purgeCache();
ToolGroupManager.destroy()

this.renderingEngine.destroy();
}
Expand Down
4 changes: 2 additions & 2 deletions examples/helpers/createStudyImageIds.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const { wadoRsRoot, StudyInstanceUID } = config;

const DX_CONFIG = {
"wadoRsRoot": "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs",
StudyInstanceUID: "1.3.6.1.4.1.14519.5.2.1.7009.2403.459769504433903221904322299373",
SeriesInstanceUID: "1.3.6.1.4.1.14519.5.2.1.7009.2403.573507813194776217846035126962"
StudyInstanceUID: "1.3.6.1.4.1.25403.345050719074.3824.20170125095258.1",
SeriesInstanceUID: "1.3.6.1.4.1.25403.345050719074.3824.20170125095258.2"
}

/**
Expand Down
Loading

0 comments on commit 34ad563

Please sign in to comment.