NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxSlicerRepSW.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
13 #include "cxSlicerRepSW.h"
14 
15 #include <vtkImageActor.h>
16 #include <vtkRenderer.h>
17 #include <vtkImageData.h>
18 
19 #include "cxView.h"
20 #include "cxImage.h"
21 #include "cxSlicedImageProxy.h"
22 #include "vtkImageMapper3D.h"
23 #include "vtkImageAlgorithm.h"
24 
25 namespace cx
26 {
27 
29  RepImpl()
30 {
31  mImageSlicer.reset(new SlicedImageProxy());
32  mImageActor = vtkImageActorPtr::New();
33  mImageActor->GetMapper()->SetInputConnection(mImageSlicer->getOutputPort()->GetOutputPort());
34 // mImageActor->SetInput(mImageSlicer->getOutputPort());
35 }
36 
38 {
39 }
40 
41 SliceRepSWPtr SliceRepSW::New(const QString& uid)
42 {
43  return wrap_new(new SliceRepSW(), uid);
44 }
45 
47 {
48  return mImageSlicer->getImage();
49 }
50 
52 {
53  return mImageActor;
54 }
55 
60 {
61  if (image == getImage())
62  return;
63  mImageSlicer->setImage(image);
64 }
65 
67 {
68  return mImageSlicer->getImage() ? mImageSlicer->getImage()->getUid() : "";
69 }
70 
72 {
73  mImageSlicer->setSliceProxy(slicer);
74 }
75 
77 {
78  view->getRenderer()->AddActor(mImageActor);
79 }
80 
82 {
83  view->getRenderer()->RemoveActor(mImageActor);
84 }
85 
86 bool SliceRepSW::hasImage(ImagePtr image) const
87 {
88  return (mImageSlicer->getImage() != NULL);
89 }
90 
92 {
93  mImageSlicer->update();
94 }
95 
96 void SliceRepSW::printSelf(std::ostream & os, Indent indent)
97 {
98  mImageSlicer->printSelf(os, indent);
99 }
100 
101 }// namespace cx
vtkImageActorPtr
vtkSmartPointer< class vtkImageActor > vtkImageActorPtr
Definition: vtkForwardDeclarations.h:64
cx::SliceRepSW::~SliceRepSW
virtual ~SliceRepSW()
Definition: cxSlicerRepSW.cpp:37
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxImage.h
cx::SliceRepSW::hasImage
bool hasImage(ImagePtr image) const
Definition: cxSlicerRepSW.cpp:86
cx::SliceRepSW::getImageUid
QString getImageUid() const
Definition: cxSlicerRepSW.cpp:66
cx::SliceRepSW::setImage
void setImage(ImagePtr image)
Definition: cxSlicerRepSW.cpp:59
cxSlicedImageProxy.h
cx::SliceRepSW::printSelf
virtual void printSelf(std::ostream &os, Indent indent)
Definition: cxSlicerRepSW.cpp:96
cx::SlicedImageProxy
Helper class for slicing an image given a SliceProxy and an image.
Definition: cxSlicedImageProxy.h:76
cx::SliceRepSW::addRepActorsToViewRenderer
virtual void addRepActorsToViewRenderer(ViewPtr view)
Definition: cxSlicerRepSW.cpp:76
cx::SliceRepSW::removeRepActorsFromViewRenderer
virtual void removeRepActorsFromViewRenderer(ViewPtr view)
Definition: cxSlicerRepSW.cpp:81
cx::SliceRepSW::setSliceProxy
void setSliceProxy(SliceProxyInterfacePtr slicer)
Definition: cxSlicerRepSW.cpp:71
cxView.h
cx::SliceRepSWPtr
boost::shared_ptr< class SliceRepSW > SliceRepSWPtr
Definition: cxForwardDeclarations.h:97
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::SliceProxyInterfacePtr
boost::shared_ptr< class SliceProxyInterface > SliceProxyInterfacePtr
Definition: cxSlicedImageProxy.h:28
cx::SliceRepSW::getImage
ImagePtr getImage()
Definition: cxSlicerRepSW.cpp:46
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::RepImpl
Default implementation of Rep.
Definition: cxRepImpl.h:42
cx::SliceRepSW::SliceRepSW
SliceRepSW()
Definition: cxSlicerRepSW.cpp:28
cxSlicerRepSW.h
cx::Indent
Formatting class for debug printing of the ssc library.
Definition: cxIndent.h:28
cx::SliceRepSW::getActor
vtkImageActorPtr getActor()
Definition: cxSlicerRepSW.cpp:51
cx::RepImpl::wrap_new
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
Definition: cxRepImpl.h:62
cx::SliceRepSW::update
void update()
Definition: cxSlicerRepSW.cpp:91
cx::SliceRepSW::New
static SliceRepSWPtr New(const QString &uid="")
Definition: cxSlicerRepSW.cpp:41