Skip to content

dcm2nii

xvr.cli.commands.dcm2nii

dcm2nii

dcm2nii(inpath, outpath)

Convert a DICOMDIR to a NIfTI file.

Source code in src/xvr/cli/commands/dcm2nii.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
@click.command(cls=CategorizedCommand)
@click.argument("inpath", type=click.Path(exists=True))
@click.argument("outpath", type=click.Path())
def dcm2nii(inpath, outpath):
    """Convert a DICOMDIR to a NIfTI file."""

    from torchio import ScalarImage

    click.echo(f"Converting {inpath} to {outpath}")

    volume = ScalarImage(inpath)
    volume.save(outpath)