def run(self, args, extra_args): dwi_name = os.path.splitext(os.path.realpath(args.dwi))[0] dwi_name = dwi_name.replace('.nii', '') if args.output_name: output_name = os.path.realpath(args.output_name) else: output_name = dwi_name + '_mask.nii.gz' if args.cl_device_ind: if isinstance(args.cl_device_ind, int): mot.configuration.set_cl_environments( [self.available_devices[args.cl_device_ind]]) else: mot.configuration.set_cl_environments([ self.available_devices[ind] for ind in args.cl_device_ind ]) mot.configuration.set_load_balancer(EvenDistribution()) mdt.create_median_otsu_brain_mask(os.path.realpath(args.dwi), os.path.realpath(args.protocol), output_name, median_radius=args.median_radius, numpass=args.numpass, dilate=args.dilate, mask_threshold=args.mask_threshold) logger = logging.getLogger(__name__) logger.info('Saved the mask to: {}'.format(output_name))
def run(self): create_median_otsu_brain_mask(*self._args, **self._kwargs) self.finished.emit()