68 this->
read( argc, argv, reportErrors );
80 comments.
addComment(
"Input file: metadata, stack, volume or image.");
84 comments.
addComment(
"Output file: metadata, stack, volume or image.");
88 comments.
addComment(
"Rootname of output individual images.");
89 comments.
addComment(
"Output image format can be set adding extension after rootname as \":ext\".");
98 addParamsLine(
" [--mode+ <mode=overwrite>] : Metadata writing mode.");
100 addParamsLine(
" overwrite : Replace the content of the file with the Metadata");
101 addParamsLine(
" append : Write the Metadata as a new block, removing the old one");
119 addParamsLine(
" [--save_metadata_stack+ <output_md=\"\">] : Create a metadata when the output (-o) is an stack");
120 addParamsLine(
" : if --oroot is used, the metadata can be saved in -o param.");
121 addParamsLine(
" : if output_md is empty, the name of the stack will be used, changing the extension to xmd.");
122 addParamsLine(
" [--track_origin+] : Store the original image filename in the output ");
124 addParamsLine(
" [--keep_input_columns+] : Preserve the columns from the input metadata.");
125 addParamsLine(
" : Some of the column values can be changed by the program.");
129 addParamsLine(
" [--dont_apply_geo] : for 2D-images: do not apply transformation stored in metadata");
135 addParamsLine(
" [--label+ <image_label=image>] : Label to be used to read/write images.");
177 this->iter =
nullptr;
204 formatString(
"Image label '%s' is missing. See option --label.", labelStr.c_str()));
217 !(
fn_out.empty() && oroot.empty()) :
false;
236 std::cout <<
"Input File: " <<
fn_in << std::endl;
238 std::cout <<
"Reading geometrical transformations stored in metadata" << std::endl;
240 std::cout <<
"Output File: " <<
fn_out << std::endl;
242 std::cout <<
"Output Root: " <<
oroot << std::endl;
285 if (outFileName.empty())
287 mdOut.
write(outFileName);
323 if (
nullptr == iter) {
328 if (*iter == mdIn->
ids().end()) {
329 throw std::logic_error(
"Iterating behind the end of the metadata");
334 bool isValid = *iter != mdIn->
ids().end();
338 objIndex = iterIndex;
345 FileName fnImg, fnImgOut, fullBaseName;
368 auto rowIn = mdIn->
getRow(objId);
397 else if (!
fn_out.empty() )
406 setupRowOut(fnImg, *rowIn.get(), fnImgOut, rowOut);
409 setupRowOut(fnImg, *rowIn.get(), fnImgOut, rowOut);
void init_progress_bar(long total)
virtual void read(int argc, const char **argv, bool reportErrors=true)
static MDLabel str2Label(const String &labelName)
#define REPORT_ERROR(nerr, ErrormMsg)
FileName removeFileFormat() const
FileName replaceExtension(const String &newExt) const
No exist requested object.
void processDefaultComment(const char *param, const char *left)
void compose(const String &str, const size_t no, const String &ext="")
int argc
Original command line arguments.
const char * getParam(const char *param, int arg=0)
String findAndReplace(const String &tInput, const String &tFind, const String &tReplace)
void progress_bar(long rlen)
void createEmptyFile(const FileName &filename, int xdim, int ydim, int Zdim, size_t select_img, bool isStack, int mode, int _swapWrite, const MDRowVec *md)
int verbose
Verbosity level.
void setValue(MDLabel label, const T &d, bool addLabel=true)
FileName withoutExtension() const
String formatString(const char *format,...)
String getFileFormat() const
virtual void initComments()
bool checkParam(const char *param)
static String label2Str(const MDLabel &label)
FileName getBaseName() const
void addParamsLine(const String &line)
std::map< String, CommentList > defaultComments