Skip to content

Commit

Permalink
ENH: Render 2D viewer annotations according to settings. #2153
Browse files Browse the repository at this point in the history
  • Loading branch information
Woundorf committed Apr 7, 2022
1 parent 56c80e6 commit 822b3d6
Show file tree
Hide file tree
Showing 12 changed files with 388 additions and 472 deletions.
38 changes: 0 additions & 38 deletions starviewer/src/core/annotationflags.h

This file was deleted.

28 changes: 8 additions & 20 deletions starviewer/src/core/q2dviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ void Q2DViewer::setNewVolumes(const QList<Volume*> &volumes, bool setViewerStatu

printVolumeInformation();

m_annotationsHandler->updateAnnotations(MainInformationAnnotation | AdditionalInformationAnnotation);
m_annotationsHandler->updateAnnotations();

loadOverlays(volumes.first());

Expand Down Expand Up @@ -788,7 +788,7 @@ void Q2DViewer::resetView(const OrthogonalPlane &view)
double slabThickness = getSlabThickness();

setCurrentViewPlane(view);
m_annotationsHandler->updateAnnotations(VoiLutAnnotation);
m_annotationsHandler->updateAnnotations();

// Reiniciem valors per defecte de la càmera
m_rotateFactor = 0;
Expand Down Expand Up @@ -994,7 +994,7 @@ void Q2DViewer::updateSliceToDisplay(int value, SliceDimension dimension)
}

updateCurrentImageDefaultPresetsInAllInputsOnOriginalAcquisitionPlane();
m_annotationsHandler->updateAnnotations(MainInformationAnnotation | AdditionalInformationAnnotation | SliceAnnotation);
m_annotationsHandler->updateAnnotations();
updatePreferredImageOrientation();

// Finally we emit the signal of the changed value and render the scene
Expand Down Expand Up @@ -1406,28 +1406,16 @@ void Q2DViewer::updateImageSlices()
getRenderer()->ResetCameraClippingRange();
}

void Q2DViewer::enableAnnotation(AnnotationFlags annotation, bool enable)
void Q2DViewer::enableAnnotations(bool enable)
{
if (enable)
{
m_annotationsHandler->enableAnnotations(annotation);
}
else
{
m_annotationsHandler->disableAnnotations(annotation);
}
m_annotationsHandler->enableAnnotations(enable);

if (hasInput())
{
render();
}
}

void Q2DViewer::removeAnnotation(AnnotationFlags annotation)
{
enableAnnotation(annotation, false);
}

void Q2DViewer::setVoiLut(const VoiLut &voiLut)
{
if (!hasInput())
Expand All @@ -1445,7 +1433,7 @@ void Q2DViewer::setVoiLut(const VoiLut &voiLut)
else
{
getMainDisplayUnit()->setVoiLut(voiLut);
m_annotationsHandler->updateAnnotations(VoiLutAnnotation);
m_annotationsHandler->updateAnnotations();
render();
}
}
Expand Down Expand Up @@ -1545,7 +1533,7 @@ void Q2DViewer::setSlabThickness(double thickness)
updateImageSlices();

updateCurrentImageDefaultPresetsInAllInputsOnOriginalAcquisitionPlane();
m_annotationsHandler->updateAnnotations(MainInformationAnnotation | AdditionalInformationAnnotation | SliceAnnotation);
m_annotationsHandler->updateAnnotations();
render();

if (mainDisplayUnit->getSlabThickness() != oldThickness)
Expand Down Expand Up @@ -2064,7 +2052,7 @@ void Q2DViewer::setFusionBalance(int balance)
this->setVolumeOpacity(1, 1.0);
}

m_annotationsHandler->updateAnnotations(MainInformationAnnotation | AdditionalInformationAnnotation);
m_annotationsHandler->updateAnnotations();
this->render();
}

Expand Down
6 changes: 2 additions & 4 deletions starviewer/src/core/q2dviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#define UDGQ2DVIEWER_H

#include "qviewer.h"
#include "annotationflags.h"
#include "anatomicalplane.h"
#include "volumedisplayunit.h"

Expand Down Expand Up @@ -328,9 +327,8 @@ public slots:
/// Indica el tipu de solapament dels volums, per defecte blending
void setOverlapMethod(OverlapMethod method);

/// Afegir o treure la visibilitat d'una anotació textual/gràfica
void enableAnnotation(AnnotationFlags annotation, bool enable = true);
void removeAnnotation(AnnotationFlags annotation);
/// Enables or disables annotations in this viewer according to the given boolean.
void enableAnnotations(bool enable);

/// Sets the VOI LUT for this viewer.
virtual void setVoiLut(const VoiLut &voiLut);
Expand Down
Loading

0 comments on commit 822b3d6

Please sign in to comment.