Main Content

dicomreadVolume

Create 4-D volume from set of DICOM images

Description

example

V= dicomreadVolume(source)创建一个4D卷,V,从一组数字成像和医学中的通信(DICOM)文件source。这dicomreadVolumefunction identifies the correct order of the images and creates a 4-D volume.

Note

If the input is a DICOM volume, then the function returns the volume data after checking the order of the image slices in the input volume. When the image slices are not in the appropriate order, the function corrects the order before returning the output.

V= dicomreadVolume(sourcetable)creates a 4-D DICOM volume from the input file listed insourcetable。这table must contain only one row that specifies the metadata for a DICOM volume.

example

V= dicomreadVolume(sourcetable,Rowname)creates a 4-D DICOM volume from the input file listed inRownameof the multirow table. Use this syntax whensourcetablecontains multiple rows.

example

V= dicomreadVolume(___,"MakeIsotropic",tf)创建一个isotropic 4-D DICOM volume from the input DICOM image data using any combination of the input arguments from previous syntaxes. Use this syntax to create an isotropic DICOM volume from a set of nonisotropic DICOM image data.

[V,spatial] = dicomreadVolume(___)also returns a structure,spatial, that describes the location, resolution, and orientation of the input DICOM data.

example

[V,spatial,dim] = dicomreadVolume(___)also returns the dimension that has the largest amount of offset between two adjacent slices in the input DICOM data.

Examples

collapse all

从包含DICOM图像文件的文件夹加载卷数据。使用squeezefunction to remove any singleton dimensions.

[V,spatial,dim] = dicomreadVolume(fullfile(matlabroot,"toolbox/images/imdata/dog")); V = squeeze(V);

Display the 4-D DICOM volume. Generate a colormap and transparency map for magnetic resonance (MR) images.

intensity = [0 20 40 120 220 1024]; alpha = [0 0 0.15 0.3 0.38 0.5]; color = ([0 0 0; 43 0 0; 103 37 20; 199 155 97; 216 213 201; 255 255 255])/ 255; queryPoints = linspace(min(intensity),max(intensity),256); alphamap = interp1(intensity,alpha,queryPoints)'; colormap = interp1(intensity,color,queryPoints);

Customize the display panel.

ViewPnl = uipanel(figure,"Title",“ 4-D DICOM卷”);

使用自定义colormap和透明度图查看音量。

Volshow(V,"Colormap",colormap,"Alphamap",alphamap,“父母”,ViewPnl);

Display the returned spatial structure fromdicomreadVolume。这结构体contains spatial information about the input DICOM image files.

spatial
spatial =struct with fields:PatientPositions: [22×3 double] PixelSpacings: [22×2 double] PatientOrientations: [2×3×22 double] ImageSize: [512 512 22]

显示从dicomreadVolume。该值指定切片偏移沿z-dimension.

dim
dim = 3

Gather details about the DICOM files contained in a folder by using thedicomCollectionfunction. The function returns the details of the available DICOM metadata in the form of a table.

sourcetable = dicomCollection(fullfile(matlabroot,"toolbox/images/imdata"));

Display the table. The table has multiple rows, with each row containing the metadata for the DICOM image sets present in the specified folder.

sourcetable
sourcetable=6×14 tableStudyDateTime SeriesDateTime PatientName PatientSex Modality Rows Columns Channels Frames StudyDescription SeriesDescription StudyInstanceUID SeriesInstanceUID Filenames ________________________ ________________________ _______________ __________ __________ ____ _______ ________ ______ ________________ _________________ __________________________________________________________________ __________________________________________________________________ ___________________________________________________________ s1 {0×0 double } {0×0 double } "" "" "RTSTRUCT" 0 00 1 "" "" "1.2.826.0.1.3680043.8.274.1.1.2729954696.96242.3632970675.507" "1.2.826.0.1.3680043.8.274.1.1.7145442384.75872.7982248107.258" {["B:\matlab\toolbox\images\imdata\rtStruct.dcm“]}} s2 {[[30-apr-1993 11:27:24]}} {[[30-apr-1993 11:27:24]}“匿名化”“ ct” 512 512 512 1 1“ rt ankle rt ankle“”“” 1.2.840.113619.2.1.1.3222987881.621.736170080.681“” 1.2.840.113619.2.1.2411.10311523115231152365.365.7365.736161692244no2-16-ankle.dcm“]} s3 {[[14-dec-2013 15:47:31]}} {[[14-dec-2013 15:54:33]}“ gorberg mitzi”“ gorberg mitzi” f“ f”512 1 22“ CSP”“ AX T2”“ 1.2.840.113619.2.244.3596.11880862.13689.1386517653.214” 1.2.840.113619.2.244.3596.11880808080862.13689.13689.13689.1365176.1365.1365.136517.1365.19.19.1965.19.19.19.19.19.199.1nymant19:18:11]}} {[03-OCT-2011 18:59:02]}“”“ M” MR“ 512 512 1 1”右膝盖“” 1.3.6.1.4.1.4.1.9590.100.100.1.2。320418845013189618318250681693358291211" "1.3.6.1.4.1.9590.100.1.2.287740981712351622214874344032214809569" {["B:\matlab\toolbox\images\imdata\knee1.dcm" ]} s5 {[03-Oct-2011 19:18:11]}{[[03-OCT-2011 19:05:04]}“”“ M” MR“ 512 512 1 1”右膝盖“”“” 1.3.6.1.4.1.4.1.4.1.4.1.1.1.2.3204981341347110345212121212121212121212121273036205155555555555555555555555555555555555555555555999999999指anS.1.1.1.6.6.1.6.6.6.6.6.6.6.6.6.6.6.6.6.and.6.9.6.6.6.6.and.n.''”。4.1.9590.100.1.2.31630298411173803803434326701385064023497963“ {[[“ b:b:b:\ matlab \ toolbox \ imags \ imdata \ imdata \ imdata \ kneee2.2.dcm”)匿名化“”“” US” 430 600 1 10“超声心动图”“ PS LAX MR&AI”“ 999.999.3859744”“ 999.999.999.94827453” {-10x-echo.dcm“]}}

Construct a 4-D DICOM volume from a DICOM image set in the table. Specify the row name that contains the desired DICOM image set. Set the name-value argumentMakeIsotropicto真的in order to create an isotropic volume. Use thesqueezefunction to remove any singleton dimensions.

V = dicomreadVolume(sourcetable,"s3","MakeIsotropic",true); V = squeeze(V);

Display the isotropic 4-D DICOM volume by using the沃尔肖function. Generate a colormap and transparency map for MR images.

intensity = [0 20 40 120 220 1024]; alpha = [0 0 0.15 0.3 0.38 0.5]; color = ([0 0 0; 43 0 0; 103 37 20; 199 155 97; 216 213 201; 255 255 255])/255; queryPoints = linspace(min(intensity),max(intensity),256); alphamap = interp1(intensity,alpha,queryPoints)'; colormap = interp1(intensity,color,queryPoints);

Customize the display panel.

ViewPnl = uipanel(figure,"Position",[0 0 1 1],"Title",“各向同性4-D DICOM体积”);

使用自定义colormap和透明度图查看音量。

Volshow(V,"Colormap",colormap,"Alphamap",alphamap,"CameraPosition",[3 3 4],“父母”,ViewPnl);

Input Arguments

collapse all

Volume data folder or files, specified as a string scalar, character vector, string array, or cell array of character vectors.

Data Types:char|string

Collection of DICOM file metadata, specified as a table returned bydicomCollection

Data Types:table

表行的名称,指定为字符串标量或字符向量。该名称标识了指定的多条表中的一行sourcetable

Data Types:char|string

Create an isotropic volume, specified as a logical0(false) or1(真的).

  • false或者0 — Create a 4-D DICOM volume from the input data.

  • 真的或者1 — Create an isotropic 4-D DICOM volume.

这input data specified bysourcecan be either isotropic or nonisotropic DICOM data.

Output Arguments

collapse all

4-D DICOM卷,作为数字阵列返回。

这dimensions ofV是(,columns,samples,slices], wheresamplesis the number of color channels per voxel. For example, grayscale volumes have one sample, and RGB volumes have three samples. Use thesqueezefunction to remove any singleton dimensions, such as when the sample is 1.

4-D array depicted as groups of 3-D grayscale volumes of size rows-by-colums-by-samples.

从输入DICOM图像的元数据中收集的切片的位置,分辨率和方向,作为带有这些字段的结构返回。

Field Description
PatientPositions (x,y,z) coordinate of the first pixel in each slice, measured in millimeters from the origin of the scanner coordinate system.
PixelSpacings Distance between neighboring rows and columns within each slice, in millimeters.
PatientOrientations Pair of direction-cosine triplets that designate the direction of the rows and columns in each slice relative to the patient position.

有关DICOM属性的更多信息,请参见DICOM标准的第3部分,第7.6.2节。

最大偏移的维度,返回为1,2, or3。这value denotes the dimension in a 3-D coordinate system that has the largest amount of offset between adjacent slices in the input DICOM data.

3-D representation of DICOM image slices

  • 是否沿最大的弥补x维度,然后dimis1

  • 是否沿最大的弥补y维度,然后dimis2

  • 是否沿最大的弥补z维度,然后dimis3

Version History

Introduced in R2017b