39 addUsageLine(
"Convert an image/volume to data and viceversa.");
40 addUsageLine(
"Data is the file format used by KerDenSOM and other classification programs");
41 addParamsLine(
" -i <file> : If Image->Vector: Input Single image/volume/stack or selfile");
43 addParamsLine(
" -o <file> : If Image->Vector: Output vector metadata");
47 addExampleLine(
"xmipp_image_vectorize -i projections.sel -o vectors.xmd");
49 addExampleLine(
"xmipp_image_vectorize -i vectors.xmd -o images.stk");
50 addExampleLine(
"Produce vectors from images or volumes with a mask",
false);
51 addExampleLine(
"xmipp_image_vectorize -i projections.sel -o vectors.xmd --mask circular -16");
52 addExampleLine(
"Produce images from vectors that were defined using a mask",
false);
53 addExampleLine(
"xmipp_image_vectorize -i vectors.xmd -o images.stk --mask circular -16");
70 <<
"Input: " << fnIn << std::endl
71 <<
"Output: " << fnOut << std::endl
80 bool headerFound=
false;
81 for (
size_t i=0;
i<blockList.size();
i++)
82 if (blockList[
i]==
"vectorHeader")
99 std::ofstream fhOutRaw(fnOutRaw.c_str(),std::ios::binary);
118 vectorSize=(int)imask.
sum();
129 buffer=
new float[vectorSize];
135 vectorContent.
addRow(dynamic_cast<const MDRowVec&>(row));
152 fhOutRaw.write((
char*)buffer,vectorSize*
sizeof(
float));
168 size_t Xdim, Ydim, Zdim, vectorSize, imgNo;
180 img().resizeNoCopy(Zdim,Ydim,Xdim);
183 auto *
buffer=
new float[vectorSize];
185 std::ifstream fhInRaw(fnInRaw.c_str(),std::ios::binary);
191 for (
size_t objId : vectorContent.
ids())
197 fhInRaw.seekg(order*vectorSize*
sizeof(
float));
198 fhInRaw.read((
char*)
buffer,vectorSize*
sizeof(
float));
202 order,fnInRaw.c_str()));
#define A2D_ELEM(v, i, j)
#define REPORT_ERROR(nerr, ErrormMsg)
Couldn't write to file.
void write(const FileName &name="", size_t select_img=ALL_IMAGES, bool isStack=false, int mode=WRITE_OVERWRITE, CastWriteMode castMode=CW_CAST, int _swapWrite=0)
void compose(const String &str, const size_t no, const String &ext="")
std::vector< String > StringVector
int readApplyGeo(const FileName &name, const MDRow &row, const ApplyGeoParams ¶ms=DefaultApplyGeoParams)
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
static void defineParams(XmippProgram *program, int allowed_data_types=ALL_KINDS, const char *prefix=nullptr, const char *comment=nullptr, bool moreOptions=false)
const char * getParam(const char *param, int arg=0)
#define FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY(v)
#define DIRECT_MULTIDIM_ELEM(v, n)
void addExampleLine(const char *example, bool verbatim=true)
File or directory does not exist.
Couldn't read from file.
void readParams(XmippProgram *program)
int verbose
Verbosity level.
void generate_mask(bool apply_geo=false)
FileName withoutExtension() const
String formatString(const char *format,...)
bool checkParam(const char *param)
void addUsageLine(const char *line, bool verbatim=false)
const MultidimArray< int > & get_binary_mask() const
void addParamsLine(const String &line)