#include <IPSDKCore/Config/LibraryInitializer.h>
#include <IPSDKBaseProcessing/Logger/IPSDKBaseProcessingException.h>
#include <IPSDKImageFile/Logger/IPSDKImageFileException.h>
#include <IPSDKBaseShapeAnalysis/Measure/Info/MeasureInfoSet.h>
#include <IPSDKBaseShapeAnalysis/Measure/MeasureSet.h>
#include <IPSDKIPL/IPSDKIPLShapeAnalysis/Measure/Geometry/FormFactor/MaxFeretDiameter/MaxFeretDiameterMsrParams.h>
#include <IPSDKIPL/IPSDKIPLShapeAnalysis/Measure/Geometry/Basic/Area2d/Area2dMsr.h>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/program_options/cmdline.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
#include <log4cplus/consoleappender.h>
#include <iostream>
bool
boost::filesystem::path& inImgFilePath,
boost::filesystem::path& outputReportPath,
int
main(
int argc,
char* argv[])
{
log4cplus::SharedAppenderPtr pConsole(new log4cplus::ConsoleAppender);
log4cplus::Logger::getRoot().addAppender(pConsole);
log4cplus::Logger::getRoot().setLogLevel(log4cplus::INFO_LOG_LEVEL);
case ipsdk::core::eLibInitStatus::eLIS_Warn:
break;
case ipsdk::core::eLibInitStatus::eLIS_Failed:
return -1;
break;
default:
break;
}
boost::filesystem::path inputImgPath, outputReportPath;
if(!
readCmdArguments(argc, argv, inputImgPath, outputReportPath, inHalfKnlSize, inSpaceSigma, inDilateFactor)) {
return -1;
}
% inputImgPath.string());
try {
% inputImgPath.string() % e.
getMsg());
return -1;
}
const path binImgPath =
ipsdk::imaproc::attr::eWatershedSeparationMode::eWSM_Split);
const std::vector<ipReal64> areaValues = outAreaMsrResults.
getColl();
const ipReal64 firstLabelArea = areaValues[1];
return 0;
}
bool
boost::filesystem::path& inputImgPath,
boost::filesystem::path& outputReportPath,
{
boost::program_options::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("inputImgFilePath", value<path>(),
"input image file path (optional; only TIFF format is accepted)")
("outputReportPath", value<path>(),
"output file path (optional; CSV resulting file path)")
("inHalfKnlSize", value<ipUInt32>(),
"half kernel size (optional; default value = 3)")
("inSpaceSigma", value<ipReal64>(),
"spatial Gaussien standard deviation (optional; default value = 8)")
("inDilateFactor", value<ipReal32>(),
"dilatation factor (optional; CSV resulting file 5)")
;
boost::program_options::variables_map vm;
try {
boost::program_options::store(parse_command_line(argc, argv, desc), vm);
} catch(const std::exception& e) {
% e.what());
return false;
}
boost::program_options::notify(vm);
if (vm.count("help")) {
std::cout << desc << "\n";
return false;
}
inputImgPath =
getIPSDKDirectory(eInternalDirectory::eID_Images) /
"blobs_483x348_UInt8.tif";
if(vm.count("inputImgFilePath"))
inputImgPath = vm["inputImgFilePath"].as<path>();
if(vm.count("outputReportPath"))
outputReportPath = vm["outputReportPath"].as<path>();
else {
const path outputDir =
"Sample";
if(!boost::filesystem::exists(outputDir)) {
try {
boost::filesystem::create_directories(outputDir);
} catch(const std::exception& e) {
% outputDir % e.what());
}
}
outputReportPath = outputDir / "quantification2d.csv";
}
inHalfKnlSize = 3;
if(vm.count("inHalfKnlSize"))
inHalfKnlSize = vm["inHalfKnlSize"].as<ipUInt32>();
inSpaceSigma = 8;
if(vm.count("inSpaceSigma"))
inSpaceSigma = vm["inSpaceSigma"].as<ipReal64>();
inDilateFactor = 5;
if(vm.count("inDilateFactor"))
inDilateFactor = vm["inDilateFactor"].as<ipReal32>();
if(!boost::filesystem::exists(inputImgPath)) {
% inputImgPath);
return false;
}
return true;
}