MeshLib Documentation
Loading...
Searching...
No Matches
Open Dicom Files

Example of opening Dicom files

  • Python
    from meshlib import mrmeshpy
    # Path to folder, that contains mutiple numbered files, like: 3DSlice1.dcm, 3DSlice2.dcm, 3DSlice3.dcm
    # Folder can contain subfolders - each will be loaded separately
    dicom_folder = 'path/to/folder'
    # Load dicom objects from folder and its subfolders
    # Result contains list of multiple objects, each object is a separate dicom volume, that correspond to each folder
    # Getting the first one here
    dicom = dicoms[0]
    # Check loading status
    if dicom:
    # In case of success you can get mrmeshpy.VdbVolume object, that is common for meshlib library
    vdb_volume = dicom.value().vol
    else:
    # print error if loading process failed
    print(dicom.error())
    std_vector_tl_expected_VoxelsLoad_DicomVolumeT_VoxelsVolumeMinMax_std_shared_ptr_OpenVdbFloatGrid_std_string loadDicomsFolderTreeAsVdb(os.PathLike|str|bytes path, int maxNumThreads=4, func_bool_from_float cb='{}')