45 #include <itkCommand.h>
51 m_InputWorldGeometry3D(NULL),
52 m_InputWorldTimeGeometry(NULL),
53 m_CreatedWorldGeometry(NULL),
54 m_ViewDirection(Axial),
55 m_DefaultViewDirection(Axial),
56 m_RenderingManager(NULL),
63 m_SliceRotationLocked(false),
66 typedef itk::SimpleMemberCommand<SliceNavigationController> SNCCommandType;
76 m_Slice->AddObserver(itk::ModifiedEvent(), sliceStepperChangedCommand);
77 m_Time->AddObserver(itk::ModifiedEvent(), timeStepperChangedCommand);
92 if (const_cast<BoundingBox *>(geometry->
GetBoundingBox())->GetDiagonalLength2() <
eps)
94 itkWarningMacro(
"setting an empty bounding-box");
108 if (geometry != NULL)
112 itkWarningMacro(
"setting an empty bounding-box");
128 if (renderingManager != NULL)
129 return renderingManager;
135 if (renderingManager != NULL)
136 return renderingManager;
145 const char *viewDirectionString;
149 viewDirectionString =
"Axial";
153 viewDirectionString =
"Sagittal";
157 viewDirectionString =
"Coronal";
161 viewDirectionString =
"Original";
165 viewDirectionString =
"No View Direction Available";
168 return viewDirectionString;
202 ((worldTimeGeometry.IsNotNull()) && (worldTimeGeometry->CountTimeSteps() == 0)))
217 this->SetViewDirection(viewDirection);
238 switch (viewDirection)
241 if (worldTimeGeometry.IsNotNull())
250 if (slicedWorldGeometry.IsNotNull())
260 if (worldSlicedGeometry != NULL)
262 slicedWorldGeometry =
static_cast<SlicedGeometry3D *
>(currentGeometry->Clone().GetPointer());
267 slicedWorldGeometry->InitializePlanes(currentGeometry,
PlaneGeometry::None, top, frontside, rotated);
268 slicedWorldGeometry->SetSliceNavigationController(
this);
273 slicedWorldGeometry->InitializePlanes(currentGeometry,
PlaneGeometry::Axial, top, frontside, rotated);
274 slicedWorldGeometry->SetSliceNavigationController(
this);
280 slicedWorldGeometry->SetSliceNavigationController(
this);
286 slicedWorldGeometry->SetSliceNavigationController(
this);
289 itkExceptionMacro(
"unknown ViewDirection");
293 m_Slice->SetSteps((
int)slicedWorldGeometry->GetSlices());
300 if (worldTimeGeometry.IsNull())
304 ->Initialize(slicedWorldGeometry, 1);
307 m_Time->InvalidateRange();
312 m_Time->SetSteps(worldTimeGeometry->CountTimeSteps());
315 const TimeBounds &timeBounds = worldTimeGeometry->GetTimeBounds();
316 m_Time->SetRange(timeBounds[0], timeBounds[1]);
320 assert(worldTimeGeometry->GetGeometryForTimeStep(this->GetTime()->GetPos()).IsNotNull());
322 TimePointType minimumTimePoint = worldTimeGeometry->TimeStepToTimePoint(this->
GetTime()->GetPos());
323 TimePointType stepDuration = worldTimeGeometry->TimeStepToTimePoint(this->
GetTime()->GetPos() + 1) -
324 worldTimeGeometry->TimeStepToTimePoint(this->
GetTime()->GetPos());
329 ->Initialize(slicedWorldGeometry, worldTimeGeometry->CountTimeSteps());
331 ->GetMinimumTimePoint(minimumTimePoint);
410 assert(timeEvent != NULL);
413 assert(timeGeometry != NULL);
415 int timeStep = (int)timeEvent->
GetPos();
426 assert(sliceEvent != NULL);
442 if (slicedWorldGeometry)
448 slices = slicedWorldGeometry->
GetSlices();
456 plane->
Project(point, projectedPoint);
460 if (direction[0] * (point[0] - projectedPoint[0]) + direction[1] * (point[1] - projectedPoint[1]) +
461 direction[2] * (point[2] - projectedPoint[2]) >=
464 bestSlice = (int)(plane->
Distance(point) / slicedWorldGeometry->
GetSpacing()[2] + 0.5);
470 for (s = 0; s < slices; ++s)
473 Vector3D distance = projectedPoint - point;
474 ScalarType currentDistance = distance.GetSquaredNorm();
476 if (currentDistance < bestDistance)
478 bestDistance = currentDistance;
543 return planeGeometry;
562 for (i = 0; i < 3; ++i)
564 if (fabs(direction[i]) < 0.000000001)
virtual const mitk::TimeGeometry * GetCreatedWorldGeometry()
Access the created geometry.
const Point3D GetOrigin() const
Get the origin, e.g. the upper-left corner of the plane.
virtual void SendCreatedWorldGeometry()
Send the created geometry to the connected observers (renderers)
mitk::Stepper * GetSlice()
Get the Stepper through the slices.
ViewDirection m_DefaultViewDirection
itk::SmartPointer< Self > Pointer
void SelectSliceByPoint(const mitk::Point3D &point)
Positions the SNC according to the specified point.
itk::FixedArray< ScalarType, 2 > TimeBounds
Standard typedef for time-bounds.
BaseRenderer * GetRenderer() const
Gets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used ...
const char * GetViewDirectionAsString() const
BoundingBox * GetBoundingBoxInWorld() const
Returns a bounding box that covers all time steps.
Baseclass for renderer slice-/camera-control.
Base class of all Operation-classes.
void SetInputWorldTimeGeometry(const mitk::TimeGeometry *geometry)
mitk::TimeGeometry::Pointer m_CreatedWorldGeometry
ViewDirection m_ViewDirection
virtual void SetViewDirectionToDefault()
void ReorientSlices(const mitk::Point3D &point, const mitk::Vector3D &normal)
Re-orients the slice stack. All slices will be oriented to the given normal vector. The given point (world coordinates) defines the selected slice. Careful: The resulting axis vectors are not clearly defined this way. If you want to define them clearly, use ReorientSlices (const mitk::Point3D &point, const mitk::Vector3D &axisVec0, const mitk::Vector3D &axisVec1).
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
ScalarType Distance(const Point3D &pt3d_mm) const
Distance of the point from the geometry (bounding-box not considered)
const mitk::Vector3D GetSpacing() const
Get the spacing (size of a pixel).
Constants for most interaction classes, due to the generic StateMachines.
virtual void SetRotated(bool _arg)
TimeGeometry * GetTimeGeometry() const
virtual void SetFrontSide(bool _arg)
unsigned long m_LastUpdateTime
mitk::RenderingManager * GetRenderingManager() const
void ExecuteOperation(Operation *operation) override
virtual void SetTop(bool _arg)
virtual void SetGeometryTime(const itk::EventObject &geometryTimeEvent)
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented inter...
virtual void SendSlice()
Send the currently selected slice to the connected observers (renderers)
virtual mitk::RenderingManager * GetRenderingManager() const
Setter for the RenderingManager that handles this instance of BaseRenderer.
mitk::BaseRenderer * m_Renderer
virtual bool GetEvenlySpaced() const
Set/Get whether the SlicedGeometry3D is evenly-spaced (m_EvenlySpaced)
Manager for coordinating the rendering process.
static RenderingManager * GetInstance()
virtual void SetGeometry(const itk::EventObject &geometrySliceEvent)
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented inter...
virtual mitk::PlaneGeometry * GetPlaneGeometry(int s) const
Returns the PlaneGeometry of the slice (s).
void SetRenderer(BaseRenderer *renderer)
Sets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used ...
const mitk::PlaneGeometry * GetCurrentPlaneGeometry()
Returns the currently selected Plane in the current BaseGeometry (if existent).
virtual TimePointType TimeStepToTimePoint(TimeStepType timeStep) const =0
Converts a time step to a time point.
Operation that handles all actions on one Point.
Operation for setting a plane (defined by its origin and normal)
mitk::ScalarType TimePointType
virtual void SetPos(unsigned int pos)
unsigned int GetPos() const
virtual unsigned int GetSlices() const
Get the number of slices.
Describes the geometry of a data object consisting of slices.
virtual void SendCreatedWorldGeometryUpdate()
Tell observers to re-read the currently selected 2D geometry.
void AdjustSliceStepperRange()
Adjusts the numerical range of the slice stepper according to the current geometry orientation of thi...
virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const
Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 3D point in mm (projec...
mitk::BaseGeometry::ConstPointer m_InputWorldGeometry3D
virtual ~SliceNavigationController()
virtual const mitk::Vector3D & GetDirectionVector() const
mitk::TimeGeometry::ConstPointer m_InputWorldTimeGeometry
SliceNavigationController()
MITKCORE_EXPORT const ScalarType eps
mitk::Stepper * GetTime()
Get the Stepper through the time.
Describes a two-dimensional, rectangular plane.
const mitk::BaseGeometry * GetCurrentGeometry3D()
Returns the BaseGeometry of the currently selected time step.
mitk::RenderingManager::Pointer m_RenderingManager
virtual void SetGeometrySlice(const itk::EventObject &geometrySliceEvent)
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented inter...
OperationType GetOperationType()
void SetInputWorldGeometry3D(const mitk::BaseGeometry *geometry)
Set the input world geometry3D out of which the geometries for slicing will be created.
ScalarType GetExtentInMM(int direction) const
Get the extent of the bounding-box in the specified direction in mm.
Message crosshairPositionEvent
ViewDirection
Possible view directions, Original will uses the PlaneGeometry instances in a SlicedGeometry3D provid...
virtual void Update()
Do the actual creation and send it to the connected observers (renderers)
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
BaseGeometry Describes the geometry of a data object.
virtual const BoundingBoxType * GetBoundingBox()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.
virtual void SendTime()
Send the currently selected time to the connected observers (renderers)