예제 #1
0
    def _run_interface(self, runtime):
        EPI_data, EPI_voxel_sizes = broccoli.load_EPI(self.inputs.epi_file)
        T1_data, T1_voxel_sizes = broccoli.load_T1(self.inputs.t1_file)

        filters_parametric_mat = scipy.io.loadmat(
            self.inputs.filters_parametric)
        filters_nonparametric_mat = scipy.io.loadmat(
            self.inputs.filters_nonparametric)

        filters_parametric = [
            filters_parametric_mat['f%d_parametric_registration' % (i + 1)]
            for i in range(3)
        ]
        filters_nonparametric = [
            filters_nonparametric_mat['f%d_nonparametric_registration' %
                                      (i + 1)] for i in range(6)
        ]

        projection_tensor = [
            filters_nonparametric_mat['m%d' % (i + 1)][0] for i in range(6)
        ]
        filter_directions = [
            filters_nonparametric_mat['filter_directions_%s' % d][0]
            for d in ['x', 'y', 'z']
        ]

        (Aligned_EPI_Volume, Interpolated_EPI_Volume, Registration_Parameters,
         Phase_Differences, Phase_Certainties,
         Phase_Gradients) = broccoli.registerEPIT1(
             EPI_data,
             EPI_voxel_sizes,
             T1_data,
             T1_voxel_sizes,
             filters_parametric,
             filters_nonparametric,
             projection_tensor,
             filter_directions,
             20,
             int(round(8.0 / T1_voxel_sizes[0])),
             20,
             self.inputs.opencl_platform,
             self.inputs.opencl_device,
             self.inputs.show_results,
         )

        T1_nni = nb.load(self.inputs.t1_file)
        aligned_EPI_nni = nb.Nifti1Image(Aligned_EPI_Volume, None,
                                         T1_nni.get_header())
        nb.save(aligned_EPI_nni, self._get_output_filename('_aligned.nii'))

        interpolated_EPI_nni = nb.Nifti1Image(Interpolated_EPI_Volume, None,
                                              T1_nni.get_header())
        nb.save(interpolated_EPI_nni,
                self._get_output_filename('_interpolated.nii'))

        return runtime
예제 #2
0
  parser.add_argument('--filters-parametric-file', type=str, default="../Matlab_Wrapper/filters_for_parametric_registration.mat")
  parser.add_argument('--filters-nonparametric-file', type=str, default="../Matlab_Wrapper/filters_for_nonparametric_registration.mat")

  parser.add_argument('--mm-epi-z-cut', type=int, default=30)
  parser.add_argument('--show-results', action='store_true')

  args = parser.parse_args()

  (T1, T1_voxel_sizes) = broccoli.load_T1(args.t1_file)
  (EPI, EPI_voxel_sizes) = broccoli.load_EPI(args.epi_file)

  coarsest_scale = 8

  filters_parametric_mat = scipy.io.loadmat(args.filters_parametric_file)
  filters_nonparametric_mat = scipy.io.loadmat(args.filters_nonparametric_file)

  parametric_filters = [filters_parametric_mat['f%d_parametric_registration' % (i+1)] for i in range(3)]
  nonparametric_filters = [filters_nonparametric_mat['f%d_nonparametric_registration' % (i+1)] for i in range(6)]

  results = broccoli.registerEPIT1(EPI, EPI_voxel_sizes, T1, T1_voxel_sizes, parametric_filters, nonparametric_filters,
                [filters_nonparametric_mat['m%d' % (i+1)][0] for i in range(6)],
                [filters_nonparametric_mat['filter_directions_%s' % d][0] for d in ['x', 'y', 'z']],
                args.iterations_parametric,
                coarsest_scale,
                args.mm_epi_z_cut,
                args.opencl_platform,
                args.opencl_device,
                args.show_results)

    def _run_interface(self, runtime):
        EPI_data, EPI_voxel_sizes = broccoli.load_EPI(self.inputs.epi_file)
        T1_data, T1_voxel_sizes = broccoli.load_T1(self.inputs.t1_file)

        filters_parametric_mat = scipy.io.loadmat(self.inputs.filters_parametric)
        filters_nonparametric_mat = scipy.io.loadmat(self.inputs.filters_nonparametric)

        filters_parametric = [filters_parametric_mat['f%d_parametric_registration' % (i+1)] for i in range(3)]
        filters_nonparametric = [filters_nonparametric_mat['f%d_nonparametric_registration' % (i+1)] for i in range(6)]

        projection_tensor = [filters_nonparametric_mat['m%d' % (i+1)][0] for i in range(6)]
        filter_directions = [filters_nonparametric_mat['filter_directions_%s' % d][0] for d in ['x', 'y', 'z']]

        (Aligned_EPI_Volume, Interpolated_EPI_Volume,
          Registration_Parameters, Phase_Differences, Phase_Certainties, Phase_Gradients) = broccoli.registerEPIT1(
            EPI_data, EPI_voxel_sizes, T1_data, T1_voxel_sizes,
            filters_parametric, filters_nonparametric, projection_tensor, filter_directions,
            20, int(round(8.0 / T1_voxel_sizes[0])), 20, self.inputs.opencl_platform, self.inputs.opencl_device, self.inputs.show_results,
        )

        T1_nni = nb.load(self.inputs.t1_file)
        aligned_EPI_nni = nb.Nifti1Image(Aligned_EPI_Volume, None, T1_nni.get_header())
        nb.save(aligned_EPI_nni, self._get_output_filename('_aligned.nii'))

        interpolated_EPI_nni = nb.Nifti1Image(Interpolated_EPI_Volume, None, T1_nni.get_header())
        nb.save(interpolated_EPI_nni, self._get_output_filename('_interpolated.nii'))

        return runtime