|
|
|
@ -4989,7 +4989,7 @@ namespace cimg_library {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Find a character in a C-string.
|
|
|
|
|
inline int strtqfind(const char *const s, const char c) {
|
|
|
|
|
inline int strfind(const char *const s, const char c) {
|
|
|
|
|
if (!s) return -1;
|
|
|
|
|
int l; for (l = cimg::strlen(s); l>=0 && s[l]!=c; --l) {}
|
|
|
|
|
return l;
|
|
|
|
@ -5047,7 +5047,7 @@ namespace cimg_library {
|
|
|
|
|
|
|
|
|
|
//! Compute the basename of a filename.
|
|
|
|
|
inline const char* basename(const char *const s) {
|
|
|
|
|
return (cimg_OS!=2)?(s?s+1+cimg::strtqfind(s,'/'):0):(s?s+1+cimg::strtqfind(s,'\\'):0);
|
|
|
|
|
return (cimg_OS!=2)?(s?s+1+cimg::strfind(s,'/'):0):(s?s+1+cimg::strfind(s,'\\'):0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Generate a random filename.
|
|
|
|
@ -5527,7 +5527,7 @@ namespace cimg_library {
|
|
|
|
|
//! Split a filename into two strings 'body' and 'extension'.
|
|
|
|
|
inline const char *split_filename(const char *const filename, char *const body=0) {
|
|
|
|
|
if (!filename) { if (body) body[0]='\0'; return 0; }
|
|
|
|
|
int l = cimg::strtqfind(filename,'.');
|
|
|
|
|
int l = cimg::strfind(filename,'.');
|
|
|
|
|
if (l>=0) { if (body) { cimg_std::strncpy(body,filename,l); body[l]='\0'; }}
|
|
|
|
|
else { if (body) cimg_std::strcpy(body,filename); l = (int)cimg::strlen(filename)-1; }
|
|
|
|
|
return filename+l+1;
|
|
|
|
@ -9875,7 +9875,7 @@ namespace cimg_library {
|
|
|
|
|
|
|
|
|
|
\par Image structure
|
|
|
|
|
|
|
|
|
|
The \ref CImg<\c T> structure tqcontains \a six fields :
|
|
|
|
|
The \ref CImg<\c T> structure contains \a six fields :
|
|
|
|
|
- \ref width defines the number of \a columns of the image (size along the X-axis).
|
|
|
|
|
- \ref height defines the number of \a rows of the image (size along the Y-axis).
|
|
|
|
|
- \ref depth defines the number of \a slices of the image (size along the Z-axis).
|
|
|
|
@ -11076,7 +11076,7 @@ namespace cimg_library {
|
|
|
|
|
|
|
|
|
|
//! Return \c true if specified referenced value is inside image boundaries. If true, returns pixel coordinates in (x,y,z,v).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& x, t& y, t& z, t& v) const {
|
|
|
|
|
bool contains(const T& pixel, t& x, t& y, t& z, t& v) const {
|
|
|
|
|
const unsigned long wh = width*height, whz = wh*depth, siz = whz*dim;
|
|
|
|
|
const T *const ppixel = &pixel;
|
|
|
|
|
if (is_empty() || ppixel<data || ppixel>=data+siz) return false;
|
|
|
|
@ -11092,7 +11092,7 @@ namespace cimg_library {
|
|
|
|
|
|
|
|
|
|
//! Return \c true if specified referenced value is inside image boundaries. If true, returns pixel coordinates in (x,y,z).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& x, t& y, t& z) const {
|
|
|
|
|
bool contains(const T& pixel, t& x, t& y, t& z) const {
|
|
|
|
|
const unsigned long wh = width*height, whz = wh*depth, siz = whz*dim;
|
|
|
|
|
const T *const ppixel = &pixel;
|
|
|
|
|
if (is_empty() || ppixel<data || ppixel>=data+siz) return false;
|
|
|
|
@ -11106,7 +11106,7 @@ namespace cimg_library {
|
|
|
|
|
|
|
|
|
|
//! Return \c true if specified referenced value is inside image boundaries. If true, returns pixel coordinates in (x,y).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& x, t& y) const {
|
|
|
|
|
bool contains(const T& pixel, t& x, t& y) const {
|
|
|
|
|
const unsigned long wh = width*height, siz = wh*depth*dim;
|
|
|
|
|
const T *const ppixel = &pixel;
|
|
|
|
|
if (is_empty() || ppixel<data || ppixel>=data+siz) return false;
|
|
|
|
@ -11118,7 +11118,7 @@ namespace cimg_library {
|
|
|
|
|
|
|
|
|
|
//! Return \c true if specified referenced value is inside image boundaries. If true, returns pixel coordinates in (x).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& x) const {
|
|
|
|
|
bool contains(const T& pixel, t& x) const {
|
|
|
|
|
const T *const ppixel = &pixel;
|
|
|
|
|
if (is_empty() || ppixel<data || ppixel>=data+size()) return false;
|
|
|
|
|
x = (t)(((unsigned long)(ppixel - data))%width);
|
|
|
|
@ -11126,7 +11126,7 @@ namespace cimg_library {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Return \c true if specified referenced value is inside the image boundaries.
|
|
|
|
|
bool tqcontains(const T& pixel) const {
|
|
|
|
|
bool contains(const T& pixel) const {
|
|
|
|
|
const T *const ppixel = &pixel;
|
|
|
|
|
return !is_empty() && ppixel>=data && ppixel<data+size();
|
|
|
|
|
}
|
|
|
|
@ -12049,8 +12049,8 @@ namespace cimg_library {
|
|
|
|
|
int
|
|
|
|
|
xm = 0, ym = 0, zm = 0, vm = 0,
|
|
|
|
|
xM = 0, yM = 0, zM = 0, vM = 0;
|
|
|
|
|
tqcontains(*pm,xm,ym,zm,vm);
|
|
|
|
|
tqcontains(*pM,xM,yM,zM,vM);
|
|
|
|
|
contains(*pm,xm,ym,zm,vm);
|
|
|
|
|
contains(*pM,xM,yM,zM,vM);
|
|
|
|
|
return CImg<Tfloat>(1,12).fill((Tfloat)m,(Tfloat)M,mean_value,variance_value,
|
|
|
|
|
(Tfloat)xm,(Tfloat)ym,(Tfloat)zm,(Tfloat)vm,
|
|
|
|
|
(Tfloat)xM,(Tfloat)yM,(Tfloat)zM,(Tfloat)vM);
|
|
|
|
@ -29775,7 +29775,7 @@ namespace cimg_library {
|
|
|
|
|
unsigned int nb_images = 0;
|
|
|
|
|
do ++nb_images; while (TIFFReadDirectory(tif));
|
|
|
|
|
if (nfirst_frame>=nb_images || (nlast_frame!=~0U && nlast_frame>=nb_images))
|
|
|
|
|
cimg::warn("CImg<%s>::load_tiff() : File '%s' tqcontains %u image(s), specified frame range is [%u,%u] (step %u).",
|
|
|
|
|
cimg::warn("CImg<%s>::load_tiff() : File '%s' contains %u image(s), specified frame range is [%u,%u] (step %u).",
|
|
|
|
|
pixel_type(),filename,nb_images,nfirst_frame,nlast_frame,nstep_frame);
|
|
|
|
|
if (nfirst_frame>=nb_images) return assign();
|
|
|
|
|
if (nlast_frame>=nb_images) nlast_frame = nb_images-1;
|
|
|
|
@ -33391,49 +33391,49 @@ namespace cimg_library {
|
|
|
|
|
|
|
|
|
|
//! Return \c true if one of the image list contains the specified referenced value. If true, set coordinates (n,x,y,z,v).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& n, t& x, t&y, t& z, t& v) const {
|
|
|
|
|
bool contains(const T& pixel, t& n, t& x, t&y, t& z, t& v) const {
|
|
|
|
|
if (is_empty()) return false;
|
|
|
|
|
cimglist_for(*this,l) if (data[l].tqcontains(pixel,x,y,z,v)) { n = (t)l; return true; }
|
|
|
|
|
cimglist_for(*this,l) if (data[l].contains(pixel,x,y,z,v)) { n = (t)l; return true; }
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Return \c true if one of the image list contains the specified referenced value. If true, set coordinates (n,x,y,z).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& n, t& x, t&y, t& z) const {
|
|
|
|
|
bool contains(const T& pixel, t& n, t& x, t&y, t& z) const {
|
|
|
|
|
t v;
|
|
|
|
|
return tqcontains(pixel,n,x,y,z,v);
|
|
|
|
|
return contains(pixel,n,x,y,z,v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Return \c true if one of the image list contains the specified referenced value. If true, set coordinates (n,x,y).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& n, t& x, t&y) const {
|
|
|
|
|
bool contains(const T& pixel, t& n, t& x, t&y) const {
|
|
|
|
|
t z,v;
|
|
|
|
|
return tqcontains(pixel,n,x,y,z,v);
|
|
|
|
|
return contains(pixel,n,x,y,z,v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Return \c true if one of the image list contains the specified referenced value. If true, set coordinates (n,x).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& n, t& x) const {
|
|
|
|
|
bool contains(const T& pixel, t& n, t& x) const {
|
|
|
|
|
t y,z,v;
|
|
|
|
|
return tqcontains(pixel,n,x,y,z,v);
|
|
|
|
|
return contains(pixel,n,x,y,z,v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Return \c true if one of the image list contains the specified referenced value. If true, set coordinates (n).
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const T& pixel, t& n) const {
|
|
|
|
|
bool contains(const T& pixel, t& n) const {
|
|
|
|
|
t x,y,z,v;
|
|
|
|
|
return tqcontains(pixel,n,x,y,z,v);
|
|
|
|
|
return contains(pixel,n,x,y,z,v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Return \c true if one of the image list contains the specified referenced value.
|
|
|
|
|
bool tqcontains(const T& pixel) const {
|
|
|
|
|
bool contains(const T& pixel) const {
|
|
|
|
|
unsigned int n,x,y,z,v;
|
|
|
|
|
return tqcontains(pixel,n,x,y,z,v);
|
|
|
|
|
return contains(pixel,n,x,y,z,v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Return \c true if the list contains the image 'img'. If true, returns the position (n) of the image in the list.
|
|
|
|
|
template<typename t>
|
|
|
|
|
bool tqcontains(const CImg<T>& img, t& n) const {
|
|
|
|
|
bool contains(const CImg<T>& img, t& n) const {
|
|
|
|
|
if (is_empty()) return false;
|
|
|
|
|
const CImg<T> *const ptr = &img;
|
|
|
|
|
cimglist_for(*this,i) if (data+i==ptr) { n = (t)i; return true; }
|
|
|
|
@ -33441,9 +33441,9 @@ namespace cimg_library {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! Return \c true if the list contains the image img.
|
|
|
|
|
bool tqcontains(const CImg<T>& img) const {
|
|
|
|
|
bool contains(const CImg<T>& img) const {
|
|
|
|
|
unsigned int n;
|
|
|
|
|
return tqcontains(img,n);
|
|
|
|
|
return contains(img,n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//@}
|
|
|
|
@ -35922,7 +35922,7 @@ namespace cimg_library {
|
|
|
|
|
unsigned int nb_images = 0;
|
|
|
|
|
do ++nb_images; while (TIFFReadDirectory(tif));
|
|
|
|
|
if (nfirst_frame>=nb_images || (nlast_frame!=~0U && nlast_frame>=nb_images))
|
|
|
|
|
cimg::warn("CImgList<%s>::load_tiff() : File '%s' tqcontains %u image(s), specified frame range is [%u,%u] (step %u).",
|
|
|
|
|
cimg::warn("CImgList<%s>::load_tiff() : File '%s' contains %u image(s), specified frame range is [%u,%u] (step %u).",
|
|
|
|
|
pixel_type(),filename,nb_images,nfirst_frame,nlast_frame,nstep_frame);
|
|
|
|
|
if (nfirst_frame>=nb_images) return assign();
|
|
|
|
|
if (nlast_frame>=nb_images) nlast_frame = nb_images-1;
|
|
|
|
|