def build(self): if self.built: return self.datasets cts = modules.build_ct(ct_data = self.pixel_array, voxel_size = self.voxel_size, center = self.center, current_study = self.current_study) x,y,z = self.mgrid() for slicei in range(len(cts)): cts[slicei].ImagePositionPatient = [x[0,0,slicei],y[0,0,slicei],z[0,0,slicei]] cts[slicei].ImageOrientationPatient = self.ImageOrientationPatient self.built = True self.datasets = cts return self.datasets