def intensity_preprocessing_mr(self, image): """ Intensity preprocessing function, working on the loaded sitk image, before resampling. :param image: The sitk image. :return: The preprocessed sitk image. """ return gaussian_sitk(image, self.input_gaussian_sigma)
def datasources(self): """ Returns the data sources that load data. { 'image:' CachedImageDataSource that loads the image files. 'landmarks:' LandmarkDataSource that loads the landmark coordinates. 'mask:' CachedImageDataSource that loads the groundtruth labels. } :return: A dict of data sources. """ preprocessing = lambda image: gaussian_sitk(image, self. input_gaussian_sigma) image_datasource = CachedImageDataSource(self.image_base_folder, '', '_image', '.mha', preprocessing=preprocessing) landmark_datasource = LandmarkDataSource(self.landmarks_file, 1, self.dim) mask_datasource = CachedImageDataSource(self.image_base_folder, '', '_label_sorted', '.mha', sitk_pixel_type=sitk.sitkUInt8) return { 'image': image_datasource, 'landmarks': landmark_datasource, 'mask': mask_datasource }
def intensity_preprocessing_ct(self, image): """ Intensity preprocessing function, working on the loaded sitk image, before resampling. :param image: The sitk image. :return: The preprocessed sitk image. """ image = ShiftScaleClampSitk(clamp_min=-1024)(image) return gaussian_sitk(image, self.input_gaussian_sigma)