14 #include <vtkImageData.h> 24 #include "vtkPointData.h" 25 #include "vtkDataArray.h" 34 mPatientModelService(patientModelService)
47 mAlgorithm = algorithm;
52 mOutputVolumeParams = outputVolumeParams;
70 if (!this->validInputData())
72 mRawOutput = this->generateRawOutputVolume();
80 if (!this->validInputData())
96 if (!this->validInputData())
101 mOutput = this->generateOutputVolume(mRawOutput);
103 Eigen::Array3i outputDims(mRawOutput->GetDimensions());
104 int total = outputDims[0] * outputDims[1] * outputDims[2];
105 report(QString(
"US Reconstruction complete: %1Mb, output=%2, algo=%3, preset=%4, angio=%5")
106 .arg(total/1024/1024)
107 .arg(mOutput->getName())
112 mPatientModelService->insertData(mOutput);
135 QString uid = this->generateOutputUid();
136 QString name = this->generateImageName(uid);
138 ImagePtr image = mPatientModelService->createSpecificData<
Image>(uid +
"_%1", name +
" %1");
142 image->get_rMd_History()->setRegistration(mOutputVolumeParams.
get_rMd());
143 image->setModality(
imUS);
151 presets->load(
"US B-Mode", image,
false,
true);
162 Eigen::Array3i dim = mOutputVolumeParams.
getDim();
173 QString ReconstructCore::generateOutputUid()
175 QString base = mFileData->getUid();
176 QString name = mFileData->getFilePath().split(
"/").back();
177 name = name.split(
".").front();
179 QStringList split = name.split(
"_");
180 QStringList prefix = split.front().split(
"-");
181 if (prefix.size() == 2)
183 split[0] = prefix[0];
190 return split.join(
"_");
198 QString ReconstructCore::generateImageName(QString uid)
const 200 QString name = uid.split(
"/").back();
201 name = name.split(
".").front();
202 QString prefix = name.split(
"_").front();
203 prefix = prefix.split(
"-").front();
204 if (prefix.isEmpty())
212 QString counter =
"";
213 QRegExp countReg(
"_[0-9]{1,2}_");
214 if (countReg.indexIn(name) > 0)
216 counter = countReg.cap(0).remove(
"_");
220 QRegExp tsReg(
"[0-9]{8}T[0-9]{6}");
221 if (tsReg.indexIn(name) > 0)
223 QString postfix = name.split(
"_").back();
225 QString timestamp = datetime.toString(
"hh:mm");
226 return prefix +
" " + counter +
" " + postfix +
" " + timestamp;
237 bool ReconstructCore::validInputData()
const 239 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.