44 #include <visp3/core/vpIoTools.h>
45 #include <visp3/core/vpMatrix.h>
46 #include <visp3/gui/vpDisplayD3D.h>
47 #include <visp3/gui/vpDisplayGDI.h>
48 #include <visp3/gui/vpDisplayGTK.h>
49 #include <visp3/gui/vpDisplayOpenCV.h>
50 #include <visp3/gui/vpDisplayX.h>
51 #include <visp3/gui/vpPlot.h>
52 #include <visp3/io/vpImageIo.h>
53 #include <visp3/io/vpParseArgv.h>
56 #include <visp3/ustk_core/usSequenceReader3D.h>
57 #include <visp3/ustk_needle_detection/usNeedleTrackerSIR2D.h>
66 #define GETOPTARGS "cdo:h"
68 void usage(
const char *name,
const char *badparam,
const std::string &opath,
const std::string &user);
69 bool getOptions(
int argc,
const char **argv, std::string &opath,
const std::string &user);
81 void usage(
const char *name,
const char *badparam,
const std::string &opath,
const std::string &user)
84 Write and read ultrasound sequences in 2d image files, and the associated xml settings file.\n\
87 %s [-o <output image path>] [-h]\n",
92 -o <output data path> %s\n\
93 Set data output path.\n\
94 From this directory, creates the \"%s\"\n\
95 subdirectory depending on the username, where \n\
96 sequenceRF2D.xml file is written.\n\
100 opath.c_str(), user.c_str());
103 fprintf(stderr,
"ERROR: \n");
104 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
117 bool getOptions(
int argc,
const char **argv, std::string &opath,
const std::string &user)
121 while ((c = vpParseArgv::parse(argc, argv, GETOPTARGS, &optarg_)) > 1) {
128 usage(argv[0], NULL, opath, user);
137 usage(argv[0], optarg_, opath, user);
143 if ((c == 1) || (c == -1)) {
145 usage(argv[0], NULL, opath, user);
146 std::cerr <<
"ERROR: " << std::endl;
147 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
154 int main(
int argc,
const char *argv[])
157 std::string vol_filename;
159 for (
int i = 0; i < argc; i++) {
160 if (std::string(argv[i]) ==
"--input")
161 vol_filename = std::string(argv[i + 1]);
162 else if (std::string(argv[i]) ==
"--help") {
163 std::cout <<
"\nUsage: " << argv[0] <<
" [--input <file.vol>] [--help]\n" << std::endl;
169 if (vol_filename.empty()) {
171 if (!env_ipath.empty())
172 vol_filename = env_ipath +
"/vol/01.vol";
174 std::cout <<
"You should set USTK_DATASET_PATH environment var to access to ustk dataset" << std::endl;
185 vpImage<unsigned char> firstFrame;
188 std::string base =
"vol%d-frame%d.png";
195 firstFrame(i, j, image(j, i, 0));
198 snprintf(buffer, 300, base.c_str(), 10, 0);
199 vpImageIo::write(firstFrame, buffer);
unsigned int getBModeSampleNumber() const
Reading of sequences of ultrasound images.
void setSequenceFileName(const std::string &sequenceFileName)
void getVolume(usImagePreScan3D< unsigned char > &preScanImage, int volumeNumberInSequence)
unsigned int getScanLineNumber() const
VISP_EXPORT std::string getDataSetPath()