pydicom----用法一

  1. pydicom-易学教程

  2. DICOM “.dcm”数据基本操作方法(python)

  3. pydicom的官方documents参考   https://pydicom.github.io/pydicom/stable/getting_started.html

  4. Python对DICOM图像进行阈值分割

 

 

1、dicom.dcmread()

def dcmread(fp, defer_size=None, stop_before_pixels=False,
            force=False, specific_tags=None):

    """Read and parse a DICOM dataset stored in the DICOM File Format.

    Read a DICOM dataset stored in accordance with the DICOM File Format
    (DICOM Standard Part 10 Section 7). If the dataset is not stored in
    accordance with the File Format (i.e. the preamble and prefix are missing,
    there are missing required Type 1 File Meta Information Group elements
    or the entire File Meta Information is missing) then you will have to
    set `force` to True.

    Parameters
    ----------
    fp : str or file-like
        Either a file-like object, or a string containing the file name. If a
        file-like object, the caller is responsible for closing it.
    defer_size : int or str or None
        If None (default), all elements read into memory. If specified, then if
        a data element's stored value is larger than `defer_size`, the value is
        not read into memory until it is accessed in code. Specify an integer
        (bytes), or a string value with units, e.g. "512 KB", "2 MB".
    stop_before_pixels : bool
        If False (default), the full file will be read and parsed. Set True to
        stop before reading (7FE0,0010) 'Pixel Data' (and all subsequent
        elements).
    force : bool
        If False (default), raises an InvalidDicomError if the file is missing
        the File Meta Information header. Set to True to force reading even if
        no File Meta Information header is found.
    specific_tags : list or None
        If not None, only the tags in the list are returned. The list
        elements can be tags or tag names. Note that the tag Specific
        Character Set is always returned if present - this ensures correct
        decoding of returned text values.

    Returns
    -------
    FileDataset
        An instance of FileDataset that represents a parsed DICOM file.

    Raises
    ------
    InvalidDicomError
        If `force` is True and the file is not a valid DICOM file.

    See Also
    --------
    pydicom.dataset.FileDataset
        Data class that is returned.
    pydicom.filereader.read_partial
        Only read part of a DICOM file, stopping on given conditions.

Examples
--------
Read and return a dataset stored in accordance with the DICOM File Format:

>>> ds = pydicom.dcmread("rtplan.dcm")
>>> ds.PatientName

Read and return a dataset not in accordance with the DICOM File Format:

>>> ds = pydicom.dcmread("rtplan.dcm", force=True)
>>> ds.PatientName

Use within a context manager:

>>> with pydicom.dcmread("rtplan.dcm") as ds:
>>>     ds.PatientName
"""

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值