7 #ifndef IMPEM2D_IMAGE_H
8 #define IMPEM2D_IMAGE_H
10 #include "IMP/em2d/em2d_config.h"
24 IMPEM2D_BEGIN_NAMESPACE
36 Image(
int rows,
int cols);
44 read(filename, reader);
57 void set_data(
const cv::Mat &mat);
70 cv::Scalar s(val, 0, 0, 0);
80 void set_value(
int i,
int j,
double val) { data_.at<
double>(i, j) = val; }
88 double operator()(
int i,
int j)
const {
return data_.at<
double>(i, j); }
104 void set_size(
int rows,
int cols);
110 void set_size(
Image *img);
118 void update_header();
127 reader->read(filename, header_, data_);
140 writer->write(filename, header_, data_);
147 void show(std::ostream &out)
const {
148 out <<
"Image name : " << name_;
176 void set_size_data(
int rows,
int cols);
246 IMPEM2DEXPORT
void do_normalize(Image *im,
bool force =
false);
279 double pixelsize,
int time_steps) {
281 pixelsize, time_steps);
284 inline void do_fill_holes(Image *input, Image *result,
double n_stddevs) {
285 do_fill_holes(input->get_data(), result->get_data(), n_stddevs);
288 inline void do_combined_fill_holes_and_threshold(Image *input, Image *result,
290 do_combined_fill_holes_and_threshold(input->get_data(), result->get_data(),
294 inline void do_extend_borders(Image *im1, Image *im2,
unsigned int pix) {
295 do_extend_borders(im1->get_data(), im2->get_data(), pix);
298 inline void do_segmentation(Image *input, Image *result,
299 const SegmentationParameters ¶ms) {
300 do_segmentation(input->get_data(), result->get_data(), params);
303 IMPEM2DEXPORT
void do_remove_small_objects(Image *input,
double percentage,
316 IMPEM2DEXPORT
void add_noise(Image *im1,
double op1,
double op2,
317 const String &mode =
"uniform",
double df = 3);
326 Image *im1, Image *im2,
const PolarResamplingParameters &polar_params);
333 IMPEM2DEXPORT
void crop(Image *img,
const IntPair ¢er,
int size);
343 IMPEM2D_END_NAMESPACE
Image processing functions.
void set_name(const String &name)
void set_value(double val)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
void apply_variance_filter(Image *input, Image *filtered, int kernelsize)
void apply_diffusion_filter(Image *input, Image *filtered, double beta, double pixelsize, int time_steps)
Virtual class for reader/writers of images.
em::ImageHeader header_
Header for the image with all the pertinent information.
Virtual class for reader/writers of images Copyright 2007-2017 IMP Inventors. All rights reserved...
Interface with OpenCV Copyright 2007-2017 IMP Inventors. All rights reserved.
std::pair< Float, Float > FloatRange
A pair representing the allowed range for a Float attribute.
void apply_mean_outside_mask(Image *img, double radius)
void set_value(int i, int j, double val)
em::ImageHeader & get_header()
Floats get_histogram(Image *img, int bins)
void do_subtract_images(Image *first, Image *second, Image *result)
A smart pointer to a reference counted object.
String name_
Name of the image. Frequently it will be the name of the file.
void read(String filename, const ImageReaderWriter *reader)
Image(String filename, const ImageReaderWriter *reader)
Common base class for heavy weight IMP objects.
void get_correlation2d(Image *im1, Image *im2, Image *corr)
Images read_images(const Strings &names, const ImageReaderWriter *rw)
Functions related with rotations in em2d Copyright 2007-2017 IMP Inventors. All rights reserved...
void crop(Image *img, const IntPair ¢er, int size)
double operator()(int i, int j) const
cv::Mat data_
Matrix with the data for the image.
double get_cross_correlation_coefficient(Image *im1, Image *im2)
Cross correlation between two images.
void save_images(Images images, const Strings &names, const ImageReaderWriter *rw)
void write(const String &filename, const ImageReaderWriter *writer)
void do_normalize(Image *im, bool force=false)
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
void do_resample_polar(Image *im1, Image *im2, const PolarResamplingParameters &polar_params)
A nullptr-initialized pointer to an IMP Object.
A shared base class to help in debugging and things.
void get_autocorrelation2d(Image *im1, Image *im2)
void show(std::ostream &out) const
Operations involving FFT Copyright 2007-2017 IMP Inventors. All rights reserved.
std::string String
Basic string value.
2D Electron Microscopy images in IMP