:return:

def _resize_if_required(self):
        """
        :return:
        """
        # orig_dtype = self.binar_segmentation.dtype

        # if orig_dtype == np.bool:
        #     segmentation = self.binar_segmentation.astype(np.int8)
        # else:
        #     segmentation = self.binar_segmentation
        if self.resized_segmentation is None:
            # segmentation = self.binar_segmentation
            segmentation = self.segmentation

            segmentation = segmentation[::self.degrad, ::self.degrad, ::self.degrad]
            voxelsize_mm = self.voxelsize_mm * self.degrad

            if self.resize_mm_1d is not None:
                logger.debug("resize begin")
                new_voxelsize_mm = np.asarray([self.resize_mm_1d, self.resize_mm_1d, self.resize_mm_1d])
                import imtools
                prev_shape = segmentation.shape
                segmentation = imtools.image_manipulation.resize_to_mm(segmentation, voxelsize_mm=voxelsize_mm,
                                                                       new_voxelsize_mm=new_voxelsize_mm, order=0)
                voxelsize_mm = new_voxelsize_mm
                logger.debug("resize finished, old shape = {}, new shape = {}".format(str(prev_shape), str(segmentation.shape)))
                # logger.debug("segmentation min={}, max={}".format(np.min(segmentation), np.max(segmentation)))
            self.resized_segmentation = segmentation
            self.resized_voxelsize_mm = voxelsize_mm