NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxUSFrameData.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 
34 #ifndef CXUSFRAMEDATA_H_
35 #define CXUSFRAMEDATA_H_
36 
37 #include "cxResourceExport.h"
38 
39 #include "cxProbeSector.h"
41 typedef vtkSmartPointer<class vtkImageImport> vtkImageImportPtr;
42 
43 namespace cx
44 {
45 typedef boost::shared_ptr<class ImageDataContainer> ImageDataContainerPtr;
46 typedef boost::shared_ptr<class CachedImageDataContainer> CachedImageDataContainerPtr;
47 }
48 
49 namespace cx
50 {
51 
52 
58 typedef boost::shared_ptr<class USFrameData> USFrameDataPtr;
59 //typedef boost::shared_ptr<class TimedPosition> TimedPositionPtr;
60 
65 class cxResource_EXPORT ProcessedUSInputData
66 {
67 public:
68  ProcessedUSInputData(std::vector<vtkImageDataPtr> frames, std::vector<TimedPosition> pos, vtkImageDataPtr mask, QString path, QString uid);
69 
70  unsigned char* getFrame(unsigned int index) const;
71  Eigen::Array3i getDimensions() const;
72  Vector3D getSpacing() const;
73  std::vector<TimedPosition> getFrames() const;
74  vtkImageDataPtr getMask();
75 
76  QString getFilePath();
77  QString getUid();
78  bool validate() const;
79 
80 private:
81  std::vector<vtkImageDataPtr> mProcessedImage;
82  std::vector<TimedPosition> mFrames;
83  vtkImageDataPtr mMask;
84  QString mPath;
85  QString mUid;
86 };
87 typedef boost::shared_ptr<ProcessedUSInputData> ProcessedUSInputDataPtr;
88 
89 
108 class cxResource_EXPORT USFrameData
109 {
110 public:
111  static USFrameDataPtr create(ImagePtr inputFrameData);
112  static USFrameDataPtr create(QString inputFilename);
113  static USFrameDataPtr create(QString name, cx::ImageDataContainerPtr images);
114  static USFrameDataPtr create(QString name, std::vector<vtkImageDataPtr> frames);
115  ~USFrameData();
116 
117  Eigen::Array3i getDimensions() const;
118  Vector3D getSpacing() const;
119  QString getName() const;
120  cx::ImageDataContainerPtr getImageContainer() { return mImageContainer; }
121  unsigned getNumImages();
122 
123  void resetRemovedFrames();
124  void removeFrame(unsigned int index);
125  void setCropBox(IntBoundingBox3D mCropbox);
126  void fillImageImport(vtkImageImportPtr import, int index);
127  void setPurgeInputDataAfterInitialize(bool value);
128 
133  std::vector<std::vector<vtkImageDataPtr> > initializeFrames(std::vector<bool> angio);
134 
135  virtual USFrameDataPtr copy();
136  void purgeAll();
137 
138  bool is4D();//Do this object contain 4D data? (Opposed to the usual 3D data)
139  bool is8bit() const;
140 
141 protected:
142  USFrameData();
143  vtkImageDataPtr useAngio(vtkImageDataPtr inData, vtkImageDataPtr grayFrame, int frameNum) const;
144 
145  vtkImageDataPtr cropImageExtent(vtkImageDataPtr input, IntBoundingBox3D cropbox) const;
146  vtkImageDataPtr to8bitGrayscaleAndEffectuateCropping(vtkImageDataPtr input) const;
147 
148  std::vector<int> mReducedToFull;
150 
151  QString mName;
154 private:
155  vtkImageDataPtr convertTo8bit(vtkImageDataPtr input) const;
156 };
157 
162 }//namespace cx
163 
164 #endif // CXUSFRAMEDATA_H_
cx::ImageDataContainerPtr getImageContainer()
cx::ImageDataContainerPtr mImageContainer
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:48
boost::shared_ptr< class USFrameData > USFrameDataPtr
std::vector< int > mReducedToFull
map from indexes in the reduced volume to the full (original) volume.
IntBoundingBox3D mCropbox
Helper class encapsulating a 2S US data set.
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
Definition: cxUSFrameData.h:41
Representation of an integer bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:63
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
boost::shared_ptr< class ProcessedUSInputData > ProcessedUSInputDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
boost::shared_ptr< class CachedImageDataContainer > CachedImageDataContainerPtr
boost::shared_ptr< class ImageDataContainer > ImageDataContainerPtr
Definition: cxUSFrameData.h:45