def METHOD_NAME():
    parser = _build_arg_parser()
    args = parser.parse_args()
    assert_inputs_exist(parser, [args.in_hdf5, args.in_target_file,
                                 args.in_transfo], args.in_deformation)
    assert_outputs_exist(parser, args, args.out_hdf5)
    # HDF5 will not overwrite the file
    if os.path.isfile(args.out_hdf5):
        os.remove(args.out_hdf5)
    with h5py.File(args.in_hdf5, 'r') as in_hdf5_file:
        with h5py.File(args.out_hdf5, 'a') as out_hdf5_file:
            transfo = load_matrix_in_any_format(args.in_transfo)
            deformation_data = None
            if args.in_deformation is not None:
                deformation_data = np.squeeze(nib.load(
                    args.in_deformation).get_fdata(dtype=float))
            target_img = nib.load(args.in_target_file)
            for key in in_hdf5_file.keys():
                group = out_hdf5_file.create_group(key)
                affine = in_hdf5_file.attrs['affine']
                dimensions = in_hdf5_file.attrs['dimensions']
                voxel_sizes = in_hdf5_file.attrs['voxel_sizes']
                streamlines = reconstruct_streamlines_from_hdf5(
                    in_hdf5_file, key)
                if len(streamlines) == 0:
                    continue
                header = create_nifti_header(affine, dimensions, voxel_sizes)
                moving_sft = StatefulTractogram(streamlines, header, Space.VOX,
                                                origin=Origin.TRACKVIS)
                for dps_key in in_hdf5_file[key].keys():
                    if dps_key not in ['data', 'offsets', 'lengths']:
                        if in_hdf5_file[key][dps_key].shape \
                                == in_hdf5_file[key]['offsets']:
                            moving_sft.data_per_streamline[dps_key] \
                                = in_hdf5_file[key][dps_key]
                new_sft = transform_warp_sft(moving_sft, transfo, target_img,
                                             inverse=args.inverse,
                                             deformation_data=deformation_data,
                                             reverse_op=args.reverse_operation,
                                             remove_invalid=not args.cut_invalid,
                                             cut_invalid=args.cut_invalid)
                new_sft.to_vox()
                new_sft.to_corner()
                affine, dimensions, voxel_sizes, voxel_order = get_reference_info(
                    target_img)
                out_hdf5_file.attrs['affine'] = affine
                out_hdf5_file.attrs['dimensions'] = dimensions
                out_hdf5_file.attrs['voxel_sizes'] = voxel_sizes
                out_hdf5_file.attrs['voxel_order'] = voxel_order
                group = out_hdf5_file[key]
                group.create_dataset('data',
                                     data=new_sft.streamlines._data.astype(np.float32))
                group.create_dataset('offsets',
                                     data=new_sft.streamlines._offsets)
                group.create_dataset('lengths',
                                     data=new_sft.streamlines._lengths)
                for dps_key in in_hdf5_file[key].keys():
                    if dps_key not in ['data', 'offsets', 'lengths']:
                        if in_hdf5_file[key][dps_key].shape \
                                == in_hdf5_file[key]['offsets']:
                            group.create_dataset(dps_key,
                                                 data=new_sft.data_per_streamline[dps_key])
                        else:
                            group.create_dataset(dps_key,
                                                 data=in_hdf5_file[key][dps_key])