/************************************************************************* ************************************************************************** #cat: binarize_V2 - Takes a padded grayscale input image and its associated #cat: Direction Map and produces a binarized version of the #cat: image. It then fills horizontal and vertical "holes" in #cat: the binary image results. Note that the input image must #cat: be padded sufficiently to contain in memory rotated #cat: directional binarization grids applied to pixels along the #cat: perimeter of the input image. Input: pdata - padded input grayscale image pw - padded width (in pixels) of input image ph - padded height (in pixels) of input image direction_map - 2-D vector of discrete ridge flow directions mw - width (in blocks) of the map mh - height (in blocks) of the map dirbingrids - set of rotated grid offsets used for directional binarization lfsparms - parameters and thresholds for controlling LFS Output: odata - points to created (unpadded) binary image ow - width of binary image oh - height of binary image Return Code: Zero - successful completion Negative - system error **************************************************************************/ int binarize_V2(unsigned char **odata, int *ow, int *oh, unsigned char *pdata, const int pw, const int ph, int *direction_map, const int mw, const int mh, const ROTGRIDS *dirbingrids, const LFSPARMS *lfsparms) { unsigned char *bdata; int i, bw, bh, ret; /* return code */ /* 1. Binarize the padded input image using directional block info. */ if((ret = binarize_image_V2(&bdata, &bw, &bh, pdata, pw, ph, direction_map, mw, mh, lfsparms->blocksize, dirbingrids))){ return(ret); } /* 2. Fill black and white holes in binary image. */ /* LFS scans the binary image, filling holes, 3 times. */ for(i = 0; i < lfsparms->num_fill_holes; i++) fill_holes(bdata, bw, bh); /* Return binarized input image. */ *odata = bdata; *ow = bw; *oh = bh; return(0); }
void bsd_exploitation(void) { printf("Exploiting %s on a *BSD\t", host); do_auth(); fill_holes(); evil_entry(); start_gzip(); try_exploit(); }
/*--------------- main routine ---------------*/ int main( int argc, char *argv[] ) { THD_3dim_dataset * countset=NULL; param_t * params = &g_params; int rv, limit; if( argc < 1 ) { show_help(); return 0; } /* general stuff */ mainENTRY("3dmask_tool"); machdep(); AFNI_logger("3dmask_tool",argc,argv); enable_mcw_malloc(); /* process options: a negative return is considered an error */ rv = process_opts(params, argc, argv); if( rv ) RETURN(rv < 0); /* open, convert to byte, zeropad, dilate, unzeropad */ if( process_input_dsets(params) ) RETURN(1); /* create mask count dataset and return num volumes (delete old dsets) */ if( count_masks(params->dsets, params->ndsets, params->verb, &countset, ¶ms->nvols) ) RETURN(1); /* limit to frac of nvols (if not counting, convert to 0/1 mask) */ limit = ceil((params->frac>1) ? params->frac : params->nvols*params->frac ); if( params->verb ) INFO_message("frac %g over %d volumes gives min count %d\n", params->frac, params->nvols, limit); if( limit <= 0 ) limit = 1; /* if not counting, result is binary 0/1 */ if( limit_to_frac(countset, limit, params->count, params->verb) ) RETURN(1); /* maybe apply dilations to output */ if( params->RESD.num > 0 ) { countset = apply_dilations(countset, ¶ms->RESD, 0, params->verb); if( !countset ) RETURN(1); } /* maybe fill any remaining holes */ if( params->fill ) if ( fill_holes(countset, params->verb) ) RETURN(1); /* create output */ if( write_result(params, countset, argc, argv) ) RETURN(1); /* clean up a little memory */ DSET_delete(countset); free(params->dsets); RETURN(0); }