21 #include <sys/types.h> 34 SimulationBatchGeneratorParameters::Pointer parameters)
36 std::string volumeNumber = std::to_string(parameters->GetVolumeIndex());
37 volumeNumber = std::string((3 - volumeNumber.length()),
'0') + volumeNumber;
42 SimulationBatchGeneratorParameters::Pointer parameters)
48 SimulationBatchGeneratorParameters::Pointer parameters)
51 std::string savePath = outputFolderName +
".nrrd";
52 std::stringstream batchstring;
53 for (
double d = parameters->GetYOffsetLowerThresholdInCentimeters();
54 d <= parameters->GetYOffsetUpperThresholdInCentimeters() + 1e-5;
55 d += parameters->GetYOffsetStepInCentimeters())
57 batchstring << parameters->GetBinaryPath() <<
" -p PROBE_DESIGN.xml -i " << savePath <<
" -o " << outputFolderName <<
"/" 58 << parameters->GetTissueName() <<
GetVolumeNumber(parameters) <<
"_yo" << round(d * 100) / 100 <<
".nrrd" <<
" -yo " << round(d * 100) / 100 <<
" -n " 59 << parameters->GetNumberOfPhotons() <<
"\n";
61 return batchstring.str();
65 SimulationBatchGeneratorParameters::Pointer parameters,
68 std::string outputFolderName = parameters->GetNrrdFilePath() +
GetOutputFolderName(parameters);
69 std::string savePath = outputFolderName +
".nrrd";
72 std::string filenameAllSimulation =
"simulate_all";
74 mkdir(outputFolderName.c_str());
75 filenameAllSimulation +=
".bat";
77 mkdir(outputFolderName.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
78 filenameAllSimulation +=
".sh";
81 std::ofstream fileAllSimulation(parameters->GetNrrdFilePath() +
"/" + filenameAllSimulation, std::ios_base::app);
82 if (fileAllSimulation.is_open())
85 fileAllSimulation.close();
static void WriteBatchFileAndSaveTissueVolume(SimulationBatchGeneratorParameters::Pointer parameters, mitk::Image::Pointer tissueVolume)
static std::string CreateBatchSimulationString(SimulationBatchGeneratorParameters::Pointer parameter)
SimulationBatchGenerator()
virtual ~SimulationBatchGenerator()
static std::string GetOutputFolderName(SimulationBatchGeneratorParameters::Pointer parameter)
static void Save(const mitk::BaseData *data, const std::string &path, bool setPathProperty=false)
Save a mitk::BaseData instance.
static std::string GetVolumeNumber(SimulationBatchGeneratorParameters::Pointer parameters)