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();
128 reader->read(filename, header_, data_);
141 writer->write(filename, header_, data_);
148 void show(std::ostream &out)
const {
149 out <<
"Image name : " << name_;
177 void set_size_data(
int rows,
int cols);
247 IMPEM2DEXPORT
void do_normalize(Image *im,
bool force =
false);
280 double pixelsize,
int time_steps) {
282 pixelsize, time_steps);
285 inline void do_fill_holes(Image *input, Image *result,
double n_stddevs) {
286 do_fill_holes(input->get_data(), result->get_data(), n_stddevs);
289 inline void do_combined_fill_holes_and_threshold(Image *input, Image *result,
291 do_combined_fill_holes_and_threshold(input->get_data(), result->get_data(),
295 inline void do_extend_borders(Image *im1, Image *im2,
unsigned int pix) {
296 do_extend_borders(im1->get_data(), im2->get_data(), pix);
299 inline void do_segmentation(Image *input, Image *result,
300 const SegmentationParameters ¶ms) {
301 do_segmentation(input->get_data(), result->get_data(), params);
304 IMPEM2DEXPORT
void do_remove_small_objects(Image *input,
double percentage,
317 IMPEM2DEXPORT
void add_noise(Image *im1,
double op1,
double op2,
318 const String &mode =
"uniform",
double df = 3);
327 Image *im1, Image *im2,
const PolarResamplingParameters &polar_params);
334 IMPEM2DEXPORT
void crop(Image *img,
const IntPair ¢er,
int size);
344 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-2022 IMP Inventors. All rights reserved...
Interface with OpenCV Copyright 2007-2022 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-2022 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-2022 IMP Inventors. All rights reserved.
std::string String
Basic string value.
2D Electron Microscopy images in IMP
void set_was_used(bool tf) const