Skip to content

Commit

Permalink
Merge pull request #619 from bnmajor/info-position
Browse files Browse the repository at this point in the history
feat(CornerAnnotation): Move corner annotation SE -> NE
  • Loading branch information
thewtex authored Nov 16, 2022
2 parents 1281359 + 6865723 commit 9670518
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
14 changes: 8 additions & 6 deletions src/Rendering/VTKJS/Images/applyRenderedImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,14 @@ function applyRenderedImage(context, { data: { name } }) {

const loadedImage = actorContext.image ?? actorContext.labelImage
const hasOneScale = loadedImage.scaleInfo.length === 1
if (hasOneScale) {
context.itkVtkView.setSeCornerAnnotation(ANNOTATION_DEFAULT)
} else {
context.itkVtkView.setSeCornerAnnotation(
`${ANNOTATION_CUSTOM_PREFIX}<td style="margin-left: 0; margin-right: auto;">${actorContext.loadedScale}</td>${ANNOTATION_CUSTOM_POSTFIX}`
)
if (context.itkVtkView.setSeCornerAnnotation) {
if (hasOneScale) {
context.itkVtkView.setSeCornerAnnotation(ANNOTATION_DEFAULT)
} else {
context.itkVtkView.setSeCornerAnnotation(
`${ANNOTATION_CUSTOM_PREFIX}<td style="margin-left: 0; margin-right: auto;">${actorContext.loadedScale}</td>${ANNOTATION_CUSTOM_POSTFIX}`
)
}
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/Rendering/VTKJS/vtk/ItkVtkViewProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ function ItkVtkViewProxy(publicAPI, model) {
model.camera.setParallelProjection(false)
if (model.volumeRepresentation) {
if (model.viewPlanes) {
publicAPI.setCornerAnnotation('se', model.seCornerAnnotation)
publicAPI.setCornerAnnotation('ne', model.neCornerAnnotation)
} else {
publicAPI.setCornerAnnotation('se', '')
publicAPI.setCornerAnnotation('ne', '')
}
if (model.imageVisibility) {
model.volumeRepresentation.setVolumeVisibility(true)
Expand All @@ -152,7 +152,7 @@ function ItkVtkViewProxy(publicAPI, model) {
} else {
// slice views
model.camera.setParallelProjection(true)
publicAPI.setCornerAnnotation('se', model.seCornerAnnotation)
publicAPI.setCornerAnnotation('ne', model.neCornerAnnotation)
model.interactor.setInteractorStyle(model.interactorStyle2D)
if (model.rotate && !!model.rotateAnimationCallback) {
model.interactor.cancelAnimation('itk-vtk-view-rotate')
Expand Down Expand Up @@ -219,7 +219,7 @@ function ItkVtkViewProxy(publicAPI, model) {
)
const ijk = model.annotationPicker.getPointIJK()
if (model.volumeRepresentation) {
publicAPI.setCornerAnnotation('se', model.seCornerAnnotation)
publicAPI.setCornerAnnotation('ne', model.neCornerAnnotation)
const imageData = model.volumeRepresentation.getInputDataSet()
const size = imageData.getDimensions()
const scalarData = imageData.getPointData().getScalars()
Expand Down Expand Up @@ -251,7 +251,7 @@ function ItkVtkViewProxy(publicAPI, model) {
}
publicAPI.updateCornerAnnotation(model.lastPickedValues)
} else {
publicAPI.setCornerAnnotation('se', '')
publicAPI.setCornerAnnotation('ne', '')
model.dataProbeActor.setVisibility(false)
model.dataProbeFrameActor.setVisibility(false)
model.lastPickedValues = null
Expand Down Expand Up @@ -391,7 +391,7 @@ function ItkVtkViewProxy(publicAPI, model) {

// Setup --------------------------------------------------------------------

publicAPI.setCornerAnnotation('se', '')
publicAPI.setCornerAnnotation('ne', '')
publicAPI.updateCornerAnnotation({
iIndex: '&nbsp;N/A',
jIndex: '&nbsp;N/A',
Expand Down Expand Up @@ -877,7 +877,7 @@ function ItkVtkViewProxy(publicAPI, model) {
model.viewPlanes = viewPlanes
if (model.viewMode === 'Volume' && model.volumeRepresentation) {
if (viewPlanes) {
publicAPI.setCornerAnnotation('se', model.seCornerAnnotation)
publicAPI.setCornerAnnotation('ne', model.neCornerAnnotation)
}
}
}
Expand Down Expand Up @@ -1065,7 +1065,7 @@ const DEFAULT_VALUES = {
imageVisibility: true,
rotate: false,
units: '',
seCornerAnnotation: CursorCornerAnnotation,
neCornerAnnotation: CursorCornerAnnotation,
labelIndex: null,
labelNames: null,
clickCallback: null,
Expand Down Expand Up @@ -1105,7 +1105,7 @@ export function extend(publicAPI, model, initialValues = {}) {

macro.setGet(publicAPI, model, [
'units',
'seCornerAnnotation',
'neCornerAnnotation',
'labelNames',
'labelIndex',
'clickCallback',
Expand Down

0 comments on commit 9670518

Please sign in to comment.