23 #include <itksys/SystemTools.hxx> 30 returnParameters->SetAirThicknessInMillimeters(12);
31 returnParameters->SetMinBackgroundAbsorption(0.1);
32 returnParameters->SetMaxBackgroundAbsorption(0.1);
33 returnParameters->SetBackgroundAnisotropy(0.9);
34 returnParameters->SetBackgroundScattering(15);
36 returnParameters->SetDoPartialVolume(
true);
37 returnParameters->SetMinNumberOfVessels(1);
38 returnParameters->SetMaxNumberOfVessels(8);
39 returnParameters->SetMinVesselAbsorption(1);
40 returnParameters->SetMaxVesselAbsorption(10);
41 returnParameters->SetMinVesselAnisotropy(0.9);
42 returnParameters->SetMaxVesselAnisotropy(0.9);
43 returnParameters->SetMinVesselBending(0.1);
44 returnParameters->SetMaxVesselBending(0.3);
45 returnParameters->SetMinVesselRadiusInMillimeters(0.25);
46 returnParameters->SetMaxVesselRadiusInMillimeters(4);
47 returnParameters->SetMinVesselScattering(15);
48 returnParameters->SetMaxVesselScattering(15);
49 returnParameters->SetMinVesselZOrigin(1.6);
50 returnParameters->SetMaxVesselZOrigin(4);
51 returnParameters->SetVesselBifurcationFrequency(5000);
52 returnParameters->SetRandomizePhysicalProperties(
false);
53 returnParameters->SetSkinThicknessInMillimeters(0);
54 returnParameters->SetUseRngSeed(
false);
55 returnParameters->SetVoxelSpacingInCentimeters(0.03);
56 returnParameters->SetXDim(140);
57 returnParameters->SetYDim(100);
58 returnParameters->SetZDim(180);
63 returnParameters->SetForceVesselsMoveAlongYDirection(
true);
68 return returnParameters;
71 struct InputParameters
73 std::string saveFolderPath;
74 std::string identifyer;
76 std::string probePath;
87 parser.
setTitle(
"Mitk Tissue Batch Generator");
88 parser.
setDescription(
"Creates in silico tissue in batch processing and automatically calculates fluence values for the central slice of the volume.");
89 parser.
setContributor(
"Computer Assisted Medical Interventions, DKFZ");
96 "Input save folder (directory)",
"input save folder",
100 "MitkMcxyz binary (file)",
"path to the MitkMcxyz binary",
107 "xml probe file (file)",
"file to the definition of the used probe (*.xml)",
111 "Verbose Output",
"Whether to produce verbose, or rather debug output");
114 "Generator identifyer (string)",
"A unique identifyer for the calculation instance");
117 "omit vessel structures (boolean flag)",
"Whether to create an empty volume with no structures inside.");
120 InputParameters input;
122 std::map<std::string, us::Any> parsedArgs = parser.
parseArguments(argc, argv);
123 if (parsedArgs.size() == 0)
126 if (parsedArgs.count(
"empty-volume"))
128 input.empty =
us::any_cast<
bool>(parsedArgs[
"empty-volume"]);
135 if (parsedArgs.count(
"verbose"))
137 input.verbose =
us::any_cast<
bool>(parsedArgs[
"verbose"]);
141 input.verbose =
false;
144 if (parsedArgs.count(
"savePath"))
146 input.saveFolderPath =
us::any_cast<std::string>(parsedArgs[
"savePath"]);
149 if (parsedArgs.count(
"mitkMcxyz"))
151 input.exePath =
us::any_cast<std::string>(parsedArgs[
"mitkMcxyz"]);
154 if (parsedArgs.count(
"probe"))
156 input.probePath =
us::any_cast<std::string>(parsedArgs[
"probe"]);
159 if (parsedArgs.count(
"identifyer"))
161 input.identifyer =
us::any_cast<std::string>(parsedArgs[
"identifyer"]);
166 input.identifyer = uid.GetUID();
168 MITK_INFO <<
"Parsing arguments...[Done]";
172 int main(
int argc,
char * argv[])
178 parameters->SetMaxNumberOfVessels(0);
179 parameters->SetMinNumberOfVessels(0);
181 MITK_INFO(input.verbose) <<
"Generating tissue..";
183 MITK_INFO(input.verbose) <<
"Generating tissue..[Done]";
185 auto inputfolder = std::string(input.saveFolderPath +
"input/");
186 auto outputfolder = std::string(input.saveFolderPath +
"output/");
187 if (!itksys::SystemTools::FileIsDirectory(inputfolder))
189 itksys::SystemTools::MakeDirectory(inputfolder);
191 if (!itksys::SystemTools::FileIsDirectory(outputfolder))
193 itksys::SystemTools::MakeDirectory(outputfolder);
196 std::string savePath = input.saveFolderPath +
"input/Phantom_" + input.identifyer +
199 std::string outputPath = input.saveFolderPath +
"output/Phantom_" + input.identifyer +
202 resultTissue =
nullptr;
204 if (!itksys::SystemTools::FileIsDirectory(outputPath))
206 itksys::SystemTools::MakeDirectory(outputPath);
209 outputPath = outputPath +
"Fluence_Phantom_" + input.identifyer;
211 MITK_INFO(input.verbose) <<
"Simulating fluence..";
215 std::string cmdString = std::string(input.exePath +
" -i " + savePath +
" -o " +
216 (outputPath +
".nrrd") +
217 " -yo " +
"0" +
" -p " + input.probePath +
222 result = std::system(cmdString.c_str());
225 MITK_INFO(input.verbose) <<
"Simulating fluence..[Done]";
int main(int argc, char *argv[])
void setContributor(std::string contributor)
InputParameters parseInput(int argc, char *argv[])
ValueType * any_cast(Any *operand)
void addArgument(const std::string &longarg, const std::string &shortarg, Type type, const std::string &argLabel, const std::string &argHelp=std::string(), const us::Any &defaultValue=us::Any(), bool optional=true, bool ignoreRest=false, bool deprecated=false, mitkCommandLineParser::Channel channel=mitkCommandLineParser::Channel::None)
std::map< std::string, us::Any > parseArguments(const StringContainerType &arguments, bool *ok=nullptr)
TissueGeneratorParameters::Pointer CreatePhantom_04_04_18_Parameters()
static InSilicoTissueVolume::Pointer GenerateInSilicoData(TissueGeneratorParameters::Pointer parameters)
GenerateInSilicoData This method will return a InSilicoTissueVolume created in terms of the given par...
void CalculateNewDirectionVectorInStraightLine(Vector::Pointer direction, double bendingFactor, std::mt19937 *rng)
CalculateNewPositionInStraightLine calculates the new position by just following the direction vector...
void setCategory(std::string category)
void setArgumentPrefix(const std::string &longPrefix, const std::string &shortPrefix)
static void Save(const mitk::BaseData *data, const std::string &path, bool setPathProperty=false)
Save a mitk::BaseData instance.
void setTitle(std::string title)
void setDescription(std::string description)
void beginGroup(const std::string &description)