Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
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) 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 #ifndef CXUSFRAMEDATA_H_
14 #define CXUSFRAMEDATA_H_
15 
16 #include "cxResourceExport.h"
17 
18 #include "cxProbeSector.h"
20 typedef vtkSmartPointer<class vtkImageImport> vtkImageImportPtr;
21 
22 namespace cx
23 {
24 typedef boost::shared_ptr<class ImageDataContainer> ImageDataContainerPtr;
25 typedef boost::shared_ptr<class CachedImageDataContainer> CachedImageDataContainerPtr;
26 }
27 
28 namespace cx
29 {
30 
31 
37 typedef boost::shared_ptr<class USFrameData> USFrameDataPtr;
38 //typedef boost::shared_ptr<class TimedPosition> TimedPositionPtr;
39 
44 class cxResource_EXPORT ProcessedUSInputData
45 {
46 public:
47  ProcessedUSInputData(std::vector<vtkImageDataPtr> frames, std::vector<TimedPosition> pos, vtkImageDataPtr mask, QString path, QString uid);
48 
49  unsigned char* getFrame(unsigned int index) const;
50  Eigen::Array3i getDimensions() const;
51  Vector3D getSpacing() const;
52  std::vector<TimedPosition> getFrames() const;
53  vtkImageDataPtr getMask();
54 
55  QString getFilePath();
56  QString getUid();
57  bool validate() const;
58 
59 private:
60  std::vector<vtkImageDataPtr> mProcessedImage;
61  std::vector<TimedPosition> mFrames;
62  vtkImageDataPtr mMask;
63  QString mPath;
64  QString mUid;
65 };
66 typedef boost::shared_ptr<ProcessedUSInputData> ProcessedUSInputDataPtr;
67 
68 
87 class cxResource_EXPORT USFrameData
88 {
89 public:
90  static USFrameDataPtr create(ImagePtr inputFrameData);
91  static USFrameDataPtr create(QString inputFilename, FileManagerServicePtr fileManager);
92  static USFrameDataPtr create(QString name, cx::ImageDataContainerPtr images);
93  static USFrameDataPtr create(QString name, std::vector<vtkImageDataPtr> frames);
94  ~USFrameData();
95 
96  Eigen::Array3i getDimensions() const;
97  Vector3D getSpacing() const;
98  QString getName() const;
99  cx::ImageDataContainerPtr getImageContainer() { return mImageContainer; }
100  unsigned getNumImages();
101 
102  void resetRemovedFrames();
103  void removeFrame(unsigned int index);
104  void setCropBox(IntBoundingBox3D mCropbox);
105  void fillImageImport(vtkImageImportPtr import, int index);
106  void setPurgeInputDataAfterInitialize(bool value);
107 
112  std::vector<std::vector<vtkImageDataPtr> > initializeFrames(std::vector<bool> angio);
113 
114  virtual USFrameDataPtr copy();
115  void purgeAll();
116 
117  bool is4D();//Do this object contain 4D data? (Opposed to the usual 3D data)
118  bool is8bit() const;
119 
120 protected:
121  USFrameData();
122  vtkImageDataPtr useAngio(vtkImageDataPtr inData, vtkImageDataPtr grayFrame, int frameNum) const;
123 
124  vtkImageDataPtr cropImageExtent(vtkImageDataPtr input, IntBoundingBox3D cropbox) const;
125  vtkImageDataPtr to8bitGrayscaleAndEffectuateCropping(vtkImageDataPtr input) const;
126 
127  std::vector<int> mReducedToFull;
129 
130  QString mName;
133 private:
134  vtkImageDataPtr convertTo8bit(vtkImageDataPtr input) const;
135 };
136 
141 }//namespace cx
142 
143 #endif // CXUSFRAMEDATA_H_
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
cx::ImageDataContainerPtr getImageContainer()
Definition: cxUSFrameData.h:99
cx::ImageDataContainerPtr mImageContainer
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
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.
Definition: cxUSFrameData.h:87
vtkSmartPointer< class vtkImageImport > vtkImageImportPtr
Definition: cxUSFrameData.h:20
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:42
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:24
Namespace for all CustusX production code.