CustusX  22.04-rc5
An IGT application
cxUsReconstructionFileMaker.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 #ifndef CXUSRECONSTRUCTIONFILEMAKER_H_
13 #define CXUSRECONSTRUCTIONFILEMAKER_H_
14 
15 #include "cxResourceExport.h"
16 
17 class QTextStream;
18 class QDir;
19 
20 #include "cxTool.h"
22 #include "cxForwardDeclarations.h"
23 
24 
25 namespace cx
26 {
27 class TimeInfo;
28 typedef boost::shared_ptr<QTextStream> QTextStreamPtr;
29 typedef boost::shared_ptr<class ImageDataContainer> ImageDataContainerPtr;
30 //typedef boost::shared_ptr<class CachedImageDataContainer> CachedImageDataContainerPtr;
31 typedef boost::shared_ptr<class SavingVideoRecorder> SavingVideoRecorderPtr;
32 
33 
48 class cxResource_EXPORT UsReconstructionFileMaker
49 {
50 public:
51  UsReconstructionFileMaker(QString sessionDescription);
53 
54  static QString createUniqueFolder(QString patientFolder, QString sessionDescription);
55  static QString createFolder(QString patientFolder, QString sessionDescription);
56  USReconstructInputData getReconstructData();
57 
61  QString writeToNewFolder(QString path, bool compression);
62 
63  QString getSessionName() const { return mSessionDescription; }
64 
65 
69  USReconstructInputData getReconstructData(cx::ImageDataContainerPtr imageData,
70  std::vector<cx::TimeInfo> imageTimestamps,
71  TimedTransformMap trackerRecordedData,
72  std::map<double, ToolPositionMetadata> trackerRecordedMetadata,
73  std::map<double, ToolPositionMetadata> referenceRecordedMetadata,
74  ToolPtr tool,
75  QString streamUid,
76  bool writeColor,
77  Transform3D rMpr);
78  void setReconstructData(USReconstructInputData data) { mReconstructData = data; }
79 
80 private:
81  enum TimeStampType
82  {
83  Modified,
84  Scanner,
85  SoftwareArrive,
86  Unknown
87  };
88  bool writeUSTimestamps(QString reconstructionFolder, QString session, std::vector<TimedPosition> ts);
89  bool writeUSTransforms(QString reconstructionFolder, QString session, std::vector<TimedPosition> ts);
90  bool writeTrackerMetadata(QString reconstructionFolder, QString session, const std::map<double, ToolPositionMetadata>& ts);
91  bool writeReferenceMetadata(QString reconstructionFolder, QString session, const std::map<double, ToolPositionMetadata>& ts);
92  bool writeMetadata(QString filename, const std::map<double, ToolPositionMetadata>& ts, QString type);
93  bool writeTrackerTransforms(QString reconstructionFolder, QString session, std::vector<TimedPosition> ts);
94  bool writeTrackerTimestamps(QString reconstructionFolder, QString session, std::vector<TimedPosition> ts);
95  void writeProbeConfiguration(QString reconstructionFolder, QString session, ProbeDefinition data, QString uid);
96  void writeUSImages(QString path, ImageDataContainerPtr images, bool compression, std::vector<TimedPosition> pos);
97  void writeMask(QString path, QString session, vtkImageDataPtr mask);
98  void writeREADMEFile(QString reconstructionFolder, QString session);
99  bool writeTimestamps(QString filename, std::vector<TimedPosition> ts, QString type, TimeStampType timeStampType = Modified);
100 
101  bool writeTransforms(QString filename, std::vector<TimedPosition> ts, QString type);
102  static bool findNewSubfolder(QString subfolderAbsolutePath);
103  void report();
104  void fillFramePositions(USReconstructInputData* data) const;
105 
106  USReconstructInputData mReconstructData;
107  QString mSessionDescription;
108  QStringList mReport;
109 };
110 
111 typedef boost::shared_ptr<UsReconstructionFileMaker> UsReconstructionFileMakerPtr;
112 
117 }
118 #endif /* CXUSRECONSTRUCTIONFILEMAKER_H_ */
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Handles writing files in the format the us reconstruction algorithm wants them.
boost::shared_ptr< class SavingVideoRecorder > SavingVideoRecorderPtr
boost::shared_ptr< QTextStream > QTextStreamPtr
Definition of characteristics for an Ultrasound Probe Sector.
void report(QString msg)
Definition: cxLogger.cpp:69
boost::shared_ptr< class UsReconstructionFileMaker > UsReconstructionFileMakerPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
void setReconstructData(USReconstructInputData data)
std::map< double, Transform3D > TimedTransformMap
boost::shared_ptr< class ImageDataContainer > ImageDataContainerPtr
Definition: cxUSFrameData.h:24
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr