#include "startReconstructions.h" #include "Data/TemperatureData.h" #include "Function.h" #include "MatlabWriter.h" #include "config/config.h" #include "log/log.h" #include "common/DICOMExporter.h" #include "common/getMeasurementMetaData.h" #include "common/getGeometryInfo.h" #include "common/estimatePulseLength.h" #include "log/notify.h" #include "transmissionReconstruction/startTransmissionReconstruction.h" #include #include #include "Parser/Parser.h" #include "Parser/Data/MetaData.h" #include "Parser/ShotList/ShotList.h" #include "Matrix.h" #include "MatlabReader.h" #include "Function1D.h" #include "Function2D.h" #include "src/common/ceMatchedFilterHandling.h" #include "src/reflectionReconstruction/preprocessData/estimateOffset.h" #include "src/reflectionReconstruction/preprocessData/precalcImageParameters.h" #include "src/reflectionReconstruction/preprocessData/preprocessTransmissionReconstructionForReflection.h" #include "src/reflectionReconstruction/startReflectionReconstruction.h" using namespace Recon; using namespace Aurora; int Recon::startReconstructions(const std::string& aDataPath, const std::string& aDataRefPath, const std::string& aOutputPath) { MatlabWriter writer(aOutputPath); Parser dataParser(aDataPath); Parser refParser(aDataRefPath); Recon::DICOMExporter exporter(dataParser.getPatientData()); exporter.setExportBasePath(aOutputPath); if(!dataParser.getShotList()->isValid()) { RECON_INFO("startReconstructions with {0}.",aDataPath); RECON_INFO("data path is invalid."); return -9; } if(!refParser.getShotList()->isValid()) { RECON_INFO("empty water path is invalid."); return -10; } //init total used receiver/emitter/motorPos Matrix motorPosTotal, slList, snList, rlList, rnList; if(transParams::runTransmissionReco && reflectParams::runReflectionReco) { motorPosTotal = auroraUnion(reflectParams::motorPos, transParams::motorPos); slList = auroraUnion(reflectParams::senderTasList, transParams::senderTasList); snList = auroraUnion(reflectParams::senderElementList, transParams::senderElementList); rlList = auroraUnion(reflectParams::receiverTasList, transParams::receiverTasList); rnList = auroraUnion(reflectParams::receiverElementList, transParams::receiverElementList); } else if(reflectParams::runReflectionReco) { motorPosTotal = reflectParams::motorPos; slList = reflectParams::senderTasList; snList = reflectParams::senderElementList; rlList = reflectParams::receiverTasList; rnList = reflectParams::receiverElementList; } else if(transParams::runTransmissionReco) { motorPosTotal = transParams::motorPos; slList = transParams::senderTasList; snList = transParams::senderElementList; rlList = transParams::receiverTasList; rnList = transParams::receiverElementList; } else { return -12; } //getMeasurementMetaData float maxNumTAS = max(auroraUnion(slList, rlList)).getData()[0]; MeasurementInfo expInfo = loadMeasurementInfos(&dataParser); TempInfo temp = getTemperatureInfo(&dataParser, maxNumTAS); CEInfo ce = getCEInfo(&dataParser, expInfo); TransFormInfo transformationInfo = getTransformationMatrix(&dataParser, motorPosTotal); Matrix transformationMatrices = transformationInfo.rotationMatrix; Matrix motorPosAvailable = transformationInfo.motorPos; Matrix motorPosAvailableRef; MeasurementInfo expInfoRef; TempInfo tempRef; CEInfo ceRef; Matrix transformationMatricesRef; //Recon::notifyProgress(1); if(transParams::runTransmissionReco) { expInfoRef = loadMeasurementInfos(&refParser); tempRef = getTemperatureInfo(&refParser, maxNumTAS); ceRef = getCEInfo(&refParser, expInfoRef); transformationInfo = getTransformationMatrix(&refParser, motorPosTotal); transformationMatricesRef = transformationInfo.rotationMatrix; motorPosAvailableRef = transformationInfo.motorPos; if(transformationMatricesRef.isNull()) { Matrix motorPos1 = Matrix::fromRawData(new float[1] {1}, 1); transformationMatricesRef = getTransformationMatrix(&refParser, motorPos1).rotationMatrix; } else { Matrix mpRef_inter = intersect(motorPosAvailableRef, transParams::motorPos); //extractMatchingReferenceMotorPosition for(int i=0; i