7 #ifndef IMPEM2D_IMAGE_H
8 #define IMPEM2D_IMAGE_H
10 #include "IMP/em2d/em2d_config.h"
29 IMPEM2D_BEGIN_NAMESPACE
43 Image(
int rows,
int cols);
52 read(filename,reader);
67 void set_data(
const cv::Mat &mat);
82 cv::Scalar s(val,0,0,0);
93 data_.at<
double>(i,j) = val;
103 return data_.at<
double>(i,j);
121 void set_size(
int rows,
int cols);
127 void set_size(
Image *img);
135 void update_header();
142 void read(
String filename,
const ImageReaderWriter *reader) {
143 Pointer<const ImageReaderWriter> ptr(reader);
144 reader->read(filename,header_,data_);
155 void write(
const String &filename,
const ImageReaderWriter *writer) {
157 writer->write(filename,header_,data_);
164 void show(std::ostream& out)
const {
165 out <<
"Image name : " << name_ ;
174 IMP_LOG_TERSE(
"Image destroyed " << this->name_ << std::endl);
202 void set_size_data(
int rows,
int cols);
228 const ImageReaderWriter *rw);
238 const ImageReaderWriter *rw);
275 IMPEM2DEXPORT
void do_normalize(Image *im,
bool force=
false);
297 Image *filtered,
int kernelsize) {
323 inline void do_fill_holes(Image *input,Image *result,
double n_stddevs) {
324 do_fill_holes(input->get_data(),result->get_data(),n_stddevs);
328 inline void do_combined_fill_holes_and_threshold(Image *input,
331 do_combined_fill_holes_and_threshold(input->get_data(),
338 inline void do_extend_borders(Image *im1,Image *im2,
unsigned int pix) {
339 do_extend_borders(im1->get_data(),im2->get_data(),pix);
343 inline void do_segmentation(Image *input,
345 const SegmentationParameters ¶ms) {
346 do_segmentation(input->get_data(),result->get_data(),params);
349 IMPEM2DEXPORT
void do_remove_small_objects(Image *input,
365 IMPEM2DEXPORT
void add_noise(Image *im1,
double op1,
double op2,
366 const String &mode =
"uniform",
double df = 3);
376 const PolarResamplingParameters &polar_params);
383 IMPEM2DEXPORT
void crop(Image *img,
const IntPair ¢er,
int size);
395 IMPEM2D_END_NAMESPACE