Пример #1
0
    def setUp(self):
        # Timing
        self.start_time = time.time()

        # DATA
        self.d = ctdata.sets[14]
        self.d.load()

        # Parameters
        det_row_count, num_proj, det_col_count = self.d.shape
        num_voxel = (det_col_count, det_col_count, det_row_count)
        voxel_size = 2 * self.d.roi_cubic_width_mm / num_voxel[0]
        source_origin = self.d.distance_source_origin_mm / voxel_size
        origin_detector = self.d.distance_origin_detector_mm / voxel_size
        angles = self.d.angles_rad
        det_col_spacing = self.d.detector_width_mm / det_col_count / voxel_size
        det_row_spacing = det_col_spacing

        # PROJECTOR
        self.projector = Projector(
            num_voxel=num_voxel,
            det_row_count=det_row_count, det_col_count=det_col_count,
            source_origin=source_origin, origin_detector=origin_detector,
            det_row_spacing=det_row_spacing, det_col_spacing=det_col_spacing,
            angles=angles)

        # ALGORITHM
        self.pc = ChambollePock(projections=self.d.projections,
                                projector=self.projector)

        self.u_shape = num_voxel
Пример #2
0
 def test_gui(self):
     num_iter = 8
     u, p, cpd, l2_atp = ChambollePock(
         projections=np.ones((100, 180, 100)),
         projector=Projector()).least_squares(
         num_iterations=num_iter,
         L=363.569641113,
         verbose=True,
         non_negativiy_constraint=True)
     self.assertEqual(u.__class__.__name__, 'ndarray')
     self.assertEqual(cpd.size, num_iter)
     self.assertEqual(l2_atp.size, num_iter)