35 #include <vtkImageData.h> 45 #include "vtkPointData.h" 46 #include "vtkDataArray.h" 55 mPatientModelService(patientModelService)
68 mAlgorithm = algorithm;
73 mOutputVolumeParams = outputVolumeParams;
91 if (!this->validInputData())
93 mRawOutput = this->generateRawOutputVolume();
101 if (!this->validInputData())
117 if (!this->validInputData())
122 mOutput = this->generateOutputVolume(mRawOutput);
124 Eigen::Array3i outputDims(mRawOutput->GetDimensions());
125 int total = outputDims[0] * outputDims[1] * outputDims[2];
126 report(QString(
"US Reconstruction complete: %1Mb, output=%2, algo=%3, preset=%4, angio=%5")
127 .arg(total/1024/1024)
128 .arg(mOutput->getName())
133 mPatientModelService->insertData(mOutput);
156 QString uid = this->generateOutputUid();
157 QString name = this->generateImageName(uid);
159 ImagePtr image = mPatientModelService->createSpecificData<
Image>(uid +
"_%1", name +
" %1");
163 image->get_rMd_History()->setRegistration(mOutputVolumeParams.
get_rMd());
164 image->setModality(
"US");
166 image->setImageType(
"Angio");
168 image->setImageType(
"B-Mode");
172 presets->load(
"US B-Mode", image,
false,
true);
183 Eigen::Array3i dim = mOutputVolumeParams.
getDim();
194 QString ReconstructCore::generateOutputUid()
196 QString base = mFileData->getUid();
197 QString name = mFileData->getFilePath().split(
"/").back();
198 name = name.split(
".").front();
200 QStringList split = name.split(
"_");
201 QStringList prefix = split.front().split(
"-");
202 if (prefix.size() == 2)
204 split[0] = prefix[0];
211 return split.join(
"_");
219 QString ReconstructCore::generateImageName(QString uid)
const 221 QString name = uid.split(
"/").back();
222 name = name.split(
".").front();
223 QString prefix = name.split(
"_").front();
224 prefix = prefix.split(
"-").front();
225 if (prefix.isEmpty())
233 QString counter =
"";
234 QRegExp countReg(
"_[0-9]{1,2}_");
235 if (countReg.indexIn(name) > 0)
237 counter = countReg.cap(0).remove(
"_");
241 QRegExp tsReg(
"[0-9]{8}T[0-9]{6}");
242 if (tsReg.indexIn(name) > 0)
244 QString postfix = name.split(
"_").back();
246 QString timestamp = datetime.toString(
"hh:mm");
247 return prefix +
" " + counter +
" " + postfix +
" " + timestamp;
258 bool ReconstructCore::validInputData()
const 260 return mAlgorithm!=0;
void threadedPostReconstruct()
void reportError(QString msg)
Abstract interface for reconstruction algorithm.
#define CX_ASSERT(statement)
double getSpacing() const
virtual void setVtkImageData(const vtkImageDataPtr &data, bool resetTransferFunctions=true)
boost::shared_ptr< class TransferFunctions3DPresets > PresetTransferFunctions3DPtr
boost::shared_ptr< class Image > ImagePtr
Eigen::Array3i getDim() const
Helper struct for sending and controlling output volume properties.
QString timestampSecondsFormat()
void threadedReconstruct()
void threadedPreReconstruct()
virtual QString getName() const =0
void initialize(InputParams input, ReconstructionMethodService *algorithm)
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
virtual bool reconstruct(ProcessedUSInputDataPtr input, vtkImageDataPtr outputData, QDomElement settings)=0
vtkImageDataPtr generateVtkImageData(Eigen::Array3i dim, Vector3D spacing, const unsigned char initValue, int components)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
void printElapsedSeconds(QString text="Elapsed time")
void setDeepModified(vtkImageDataPtr image)
ReconstructCore(PatientModelServicePtr patientModelService)
boost::shared_ptr< class ProcessedUSInputData > ProcessedUSInputDataPtr
virtual ~ReconstructCore()
Namespace for all CustusX production code.