Esempio n. 1
0
    def _filter_chunk(self, slice_list, data, output, processes, process):
        logging.debug("Running filter._filter_chunk")
        process_slice_list = du.get_slice_list_per_process(slice_list, process, processes)

        padding = self.get_filter_padding()

        for sl in process_slice_list:
            section = du.get_padded_slice_data(sl, padding, data)
            result = self.filter_frame(section)
            if type(result) == dict:
                for key in result.keys():
                    if key == "center_of_rotation":
                        frame = du.get_orthogonal_slice(sl, data.core_directions[self.get_filter_frame_type()])
                        output.center_of_rotation[frame] = result[key]
                    elif key == "data":
                        output.data[sl] = du.get_unpadded_slice_data(sl, padding, data, result)
            else:
                output.data[sl] = du.get_unpadded_slice_data(sl, padding, data, result)
Esempio n. 2
0
    def _filter_chunk(self, slice_list, data, output, processes, process):
        logging.debug("Running filter._filter_chunk")
        process_slice_list = du.get_slice_list_per_process(slice_list, process, processes)

        padding = self.get_filter_padding()

        for sl in process_slice_list:
            section = du.get_padded_slice_data(sl, padding, data)
            result = self.filter_frame(section)
            output.data[sl] = du.get_unpadded_slice_data(sl, padding, data, result)
Esempio n. 3
0
    def _filter_chunk(self, slice_list, data, output, processes, process):
        logging.debug("Running filter._filter_chunk")
        process_slice_list = du.get_slice_list_per_process(slice_list,
                                                           process, processes)

        padding = self.get_filter_padding()

        for sl in process_slice_list:
            section = du.get_padded_slice_data(sl, padding, data)
            result = self.filter_frame(section)
            if type(result) == dict:
                for key in result.keys():
                    if key == 'center_of_rotation':
                        frame = du.get_orthogonal_slice(sl, data.core_directions[self.get_filter_frame_type()])
                        output.center_of_rotation[frame] = result[key]
                    elif key == 'data':
                        output.data[sl] = du.get_unpadded_slice_data(sl, padding, data, result)
            else:
                output.data[sl] = du.get_unpadded_slice_data(sl, padding, data, result)
Esempio n. 4
0
    def test_get_unpadded_slice_data_2(self):
        data = tu.get_nx_tomo_test_data()
        sl = du.get_grouped_slice_list(data, struct.CD_SINOGRAM, 1)

        padding_dict = {}
        #padding_dict[struct.CD_PROJECTION] = 1

        psl0_0 = du.get_padded_slice_data(sl[0], padding_dict, data)
        psl5_0 = du.get_padded_slice_data(sl[5], padding_dict, data)
        self.assertEqual(psl0_0.shape, (111, 1, 160))
        self.assertEqual(psl5_0.shape, (111, 1, 160))

        raw0 = data.data[sl[0]]
        psl0_un = du.get_unpadded_slice_data(sl[0], padding_dict, data, psl0_0)
        self.assertEqual(psl0_un.shape, raw0.shape)  # here
        self.assertEqual(psl0_un.sum(), raw0.sum())

        raw5 = data.data[sl[5]]
        psl5_un = du.get_unpadded_slice_data(sl[5], padding_dict, data, psl5_0)
        self.assertEqual(psl5_un.shape, raw5.shape)
        self.assertEqual(psl5_un.sum(), raw5.sum())
Esempio n. 5
0
    def test_get_unpadded_slice_data(self):
        data = tu.get_nx_tomo_test_data()
        sl = du.get_grouped_slice_list(data, struct.CD_ROTATION_AXIS, 8)

        padding_dict = {}
        padding_dict[struct.CD_PROJECTION] = 1

        psl0_0 = du.get_padded_slice_data(sl[0], padding_dict, data)
        psl5_0 = du.get_padded_slice_data(sl[5], padding_dict, data)
        self.assertEqual(psl0_0.shape, (111, 3, 10))
        self.assertEqual(psl5_0.shape, (111, 3, 10))

        raw0 = data.data[sl[0]]
        psl0_un = du.get_unpadded_slice_data(sl[0], padding_dict, data, psl0_0)
        self.assertEqual(psl0_un.squeeze().shape, raw0.shape)
        self.assertEqual(psl0_un.sum(), raw0.sum())

        raw5 = data.data[sl[5]]
        psl5_un = du.get_unpadded_slice_data(sl[5], padding_dict, data, psl5_0)
        self.assertEqual(psl5_un.squeeze().shape, raw5.shape)
        self.assertEqual(psl5_un.sum(), raw5.sum())
Esempio n. 6
0
 def test_get_unpadded_slice_data_2(self):
     data = tu.get_nx_tomo_test_data()
     sl = du.get_grouped_slice_list(data, struct.CD_SINOGRAM, 1)
     
     padding_dict = {}
     #padding_dict[struct.CD_PROJECTION] = 1
     
     psl0_0 = du.get_padded_slice_data(sl[0], padding_dict, data)
     psl5_0 = du.get_padded_slice_data(sl[5], padding_dict, data)
     self.assertEqual(psl0_0.shape, (111, 1, 160))
     self.assertEqual(psl5_0.shape, (111, 1, 160))
     
     raw0 = data.data[sl[0]]
     psl0_un = du.get_unpadded_slice_data(sl[0], padding_dict, data, psl0_0)
     self.assertEqual(psl0_un.shape, raw0.shape) # here
     self.assertEqual(psl0_un.sum(), raw0.sum())
     
     raw5 = data.data[sl[5]]
     psl5_un = du.get_unpadded_slice_data(sl[5], padding_dict, data, psl5_0)
     self.assertEqual(psl5_un.shape, raw5.shape)
     self.assertEqual(psl5_un.sum(), raw5.sum())
Esempio n. 7
0
 def test_get_unpadded_slice_data(self):
     data = tu.get_nx_tomo_test_data()
     sl = du.get_grouped_slice_list(data, struct.CD_ROTATION_AXIS, 8)
     
     padding_dict = {}
     padding_dict[struct.CD_PROJECTION] = 1
     
     psl0_0 = du.get_padded_slice_data(sl[0], padding_dict, data)
     psl5_0 = du.get_padded_slice_data(sl[5], padding_dict, data)
     self.assertEqual(psl0_0.shape, (111, 3, 10))
     self.assertEqual(psl5_0.shape, (111, 3, 10))
     
     raw0 = data.data[sl[0]]
     psl0_un = du.get_unpadded_slice_data(sl[0], padding_dict, data, psl0_0)
     self.assertEqual(psl0_un.squeeze().shape, raw0.shape)
     self.assertEqual(psl0_un.sum(), raw0.sum())
     
     raw5 = data.data[sl[5]]
     psl5_un = du.get_unpadded_slice_data(sl[5], padding_dict, data, psl5_0)
     self.assertEqual(psl5_un.squeeze().shape, raw5.shape)
     self.assertEqual(psl5_un.sum(), raw5.sum())