22 int width = get_Width();
24 for (
int j=0; j<
height; j++) {
25 for (
int i=0; i<
width; i++) {
30 dest -> set_Title(get_Title()+
" copy");
37 if (x >= 0 && x < get_Width() && y >= 0 && y < get_Height()) {
38 return m_Image.value((get_Height()-y-1)*get_Width()+x);
46 if (x >= 0 && x < get_Width() && y >= 0 && y < get_Height()) {
47 m_Image[(get_Height()-y-1)*get_Width()+x] = mval;
53 double cx = get_Width()/2, cy = get_Height()/2;
54 for (
int y=0; y<get_Height(); y++) {
55 double dy = (((double)y)-cy)/cy;
56 double dx = sqrt(1-dy*dy);
57 int x0 = (int) (cx-dx*cx);
58 int x1 = (int) (cx+dx*cx);
60 for (
int x=0; x<x0; x++) {
64 for (
int x=x0; x<x1; x++) {
68 for (
int x=x1; x<get_Width(); x++) {
89 for (
int i=0; i<total; i++) {
107 int height = get_Height();
108 int width = get_Width();
110 for (
int j=0; j<
height; j++) {
111 for (
int i=0; i<
width; i++) {
113 for (
int ii=-1; ii<2; ii++) {
114 for (
int jj=-1; jj<2; jj++) {
115 res = qMin(res, (
short) copy->maskValue(i+ii, j+jj));
127 int height = get_Height();
128 int width = get_Width();
130 for (
int j=0; j<
height; j++) {
131 for (
int i=0; i<
width; i++) {
133 for (
int ii=-1; ii<2; ii++) {
134 for (
int jj=-1; jj<2; jj++) {
135 res = qMax(res, (
short) copy->maskValue(i+ii, j+jj));
145 int height = get_Height();
146 int width = get_Width();
148 for (
int j=0; j<
height; j++) {
149 for (
int i=0; i<
width; i++) {
157 int height = get_Height();
158 int width = get_Width();
160 for (
int j=0; j<
height; j++) {
161 for (
int i=0; i<
width; i++) {
169 int height = get_Height();
170 int width = get_Width();
172 for (
int j=0; j<
height; j++) {
173 for (
int i=0; i<
width; i++) {
181 int height = get_Height();
182 int width = get_Width();
184 for (
int j=0; j<
height; j++) {
185 for (
int i=0; i<
width; i++) {
193 int height = get_Height();
194 int width = get_Width();
196 for (
int j=0; j<
height; j++) {
197 for (
int i=0; i<
width; i++) {
205 int height = get_Height();
206 int width = get_Width();
208 for (
int j=0; j<
height; j++) {
209 for (
int i=0; i<
width; i++) {
217 for (
int j=0; j<=r; j++) {
218 double dy = (((double)j)/r);
220 double dx = sqrt(1-dy*dy);
221 int x0 = (int) (cx - dx*r);
222 int x1 = (int) (cx + dx*r);
224 for (
int i=x0; i<x1; i++) {
239 for (
int i=0; i<total; i++) {
245 return tr(
"%1/%2 pixels set").arg(totalSet).arg(total);
253 for (
int i=0; i<total; i++) {
267 for (
int i=0; i<total; i++) {
283 int height = get_Height();
284 int width = get_Width();
287 double sc_height = height/th_height;
288 double sc_width = width/th_width;
289 int threshold = sc_height*sc_width;
290 double scale = qMin(sc_height, sc_width);
291 th_width = width/scale;
292 th_height = height/scale;
294 QImage res(th_width, th_height, QImage::Format_RGB32);
296 for (
int j=0; j<th_height; j++) {
297 for (
int i=0; i<th_width; i++) {
299 for (
int jsc = 0; jsc<sc_height; jsc++) {
300 for (
int isc = 0; isc<sc_width; isc++) {
301 if (
maskValue(i*scale+isc, j*scale+jsc)) {
307 int val = tot*255/(threshold+1);
309 res.setPixel(i,th_height-j-1, qRgb(255-val,0,0));
321 template <
typename T>
324 int nRows = image -> get_Height();
325 int nCols = image -> get_Width();
327 for (
int y=0; y<nRows; y++) {
328 for (
int x=0; x<nCols; x++) {
329 T v = image ->
value(x,y);
331 if (((v >= min) && (v < max)) == inRange) {
338 template <
typename T>
341 setMaskRange<T>(image, min, max,
true,
false);
344 template <
typename T>
347 setMaskRange<T>(image, min, max,
true,
true);
350 template void QcepMaskData::hideMaskRange<double>(QSharedPointer<QcepImageData<double> >, double, double);
351 template void QcepMaskData::showMaskRange<double>(QSharedPointer<QcepImageData<double> >, double, double);
void xorMask(QcepMaskDataPtr mask)
void setMaskValue(int x, int y, bool mval)
int countUnmaskedPixels() const
void orMask(QcepMaskDataPtr mask)
int countOverflowPixels() const
void xorNotMask(QcepMaskDataPtr mask)
void andMask(QcepMaskDataPtr mask)
short value(int x, int y) const
QImage thumbnailImage() const
QcepMaskData(QcepSettingsSaverWPtr saver, int width, int height, int def, QcepObject *parent)
QcepMaskDataPtr copyMask(QcepObject *parent)
void orNotMask(QcepMaskDataPtr mask)
bool maskValue(int x, int y) const
void andNotMask(QcepMaskDataPtr mask)
void setValue(int x, int y, short val)
short defaultValue() const
QSize thumbnailImageSize() const
void copyMaskTo(QcepMaskDataPtr dest)
int countMaskedPixels() const
void hideMaskRange(QSharedPointer< QcepImageData< T > > image, T min, T max)
static QcepMaskDataPtr newMask(AllocationStrategy strat, int width, int height, int def, QcepObject *parent)
QSharedPointer< QcepMaskData > QcepMaskDataPtr
void maskCircle(double cx, double cy, double r, bool val)
void setMaskRange(QSharedPointer< QcepImageData< T > > image, T min, T max, bool inRange, bool setTo)
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr
void showMaskRange(QSharedPointer< QcepImageData< T > > image, T min, T max)
QcepSettingsSaverWPtr saver()