file_out)
¶name, value)
¶Anonymize a DICOM format file by removing or replacing specific fields.
file_in is filename to read from.
file_out is the filename to write to.
name, value optional name/value properties.
Known property names are:
The value is a cell array of names to not remove during the anonymize procedure.
A structure of name/values to update rather than remove.
None
See also: dicomread, dicomwrite, dicominfo.
dictionary_name =
dicomdict ("get"
)
¶("factory"
)
¶("set"
, dictionary_name)
¶Get or set the active dicom data dictionary.
The first usage returns the filename of the dictionary that is currently being used.
Using "factory"
resets the dictionary to the default.
Using "set"
allows setting the dictionary for future operations.
In this case, the dictionary file dictionary_name can be anywhere in the path.
code - string value of ’get’, ’set’ or ’factory’.
dictionary_name’ - name of dictionary file to use
dictionary_name’ - name of dictionary file currently set for dictionaty
Get current dicom dict path:
> f = dicomdict('get') f = octavedicom.dic
Set a new dictionary:
> dicomdict('set', 'anewdictfile.txt')
See also: dicomread, dicomwrite.
(filename)
¶(filename, [propertyname, propertvalue ...])
¶Read and display the metadata from a DICOM file.
filename - dicomfilename to display.
propertyname, propertvalue - property pairs for options to the display function.
Currently the only known property is ’dictionary’ to specify a non default dict to use.
None
See also: dicomread, dicominfo.
attrinfo
= dicomfind(filename, attribute)
¶attrinfo
= dicomfind(info, attribute)
¶Find the location and value of an attribute in a dicom file or info structure.
filename - filename to open.
info - dicominfo struct.
attribute - attribute name to find.
attrinfo - a table with fields Location and Value for each matched attribute.
The Location value will be the attribute position in dot notation to show its position in dicom info structure.
filename = file_in_loadpath("imdata/rtstruct.dcm"); info = dicomfind(filename, "ROINumber");
info
= dicominfo (filename)
¶info
= dicominfo (filename, "dictionary"
, dictionary-name)
¶(___, options)
¶Get all metadata from a DICOM file, excluding any actual image. info is a nested struct containing the data.
If the dictionary
argument is used, the given dictionary-name is used for this operation,
otherwise, the dictionary set by dicomdict
is used.
filename - name of file to read.
’dictionary’ - string constant of ’dictionary’.
dictionary-name - filename of dictionary to use.
options - a string in format of ’optionname=value’, or property/value pair ’optionname’, value:
truncate=n
where n is the number of characters to limit the dump output display to n
for each value.
info - struct of fields read frome the dicom file.
Read the metadata of a dicomfile:
> info = dicominfo(file_in_loadpath('imdata/simple-test.dcm') info = scalar structure containing the fields: Filename = a.dcm FileModDate = 04-Feb-2017 02:08:31 FileMetaInformationVersion = 0 1 MediaStorageSOPClassUID = 1.2.840.10008.5.1.4.1.1.7 MediaStorageSOPInstanceUID = 1.2.826.0.1.3680043.2.1143.4379544382488839209812957878553810312 TransferSyntaxUID = 1.2.840.10008.1.2 ImplementationClassUID = 1.2.826.0.1.3680043.2.1143.107.104.103.115.2.6.3 ImplementationVersionName = GDCM 2.6.3 SourceApplicationEntityTitle = GDCM ImageType = DERIVED \\SECONDARY SOPClassUID = 1.2.840.10008.5.1.4.1.1.7 SOPInstanceUID = 1.2.826.0.1.3680043.2.1143.4379544382488839209812957878553810312 StudyDate = 20170203 StudyTime = 210831.360586 Modality = OT ConversionType = WSD NominalScannedPixelSpacing = 1 1 StudyInstanceUID = 1.2.826.0.1.3680043.2.1143.1282184104726305239898701219563360204 SeriesInstanceUID = 1.2.826.0.1.3680043.2.1143.9385265081744858155080799316976198629 SamplesPerPixel = 1 PhotometricInterpretation = MONOCHROME1 Rows = 10 Columns = 5 BitsAllocated = 8 BitsStored = 8 HighBit = 7 PixelRepresentation = 0 RescaleIntercept = 0 RescaleSlope = 1 RescaleType = US PixelData = not assigned
See also: dicomread, dicomdict.
keyword
= dicomlookup (group, element)
¶[group,
element] = dicomlookup (keyword)
¶Lookup an attribute in the DICOM data dictionary.
keyword = dicomlookup (group, element) will look in the current dicom dictionary for a specified group and element tag and returns string name of the attribute.
[group, element] = dicomlookup (keyword) will look in the current dicom dictionary for a specified keyword string and returns the group and element for keyword.
keyword - string keyword name to look up a group, element value.
group - group value to look up (string or integer).
element - element value to look up (string or integer).
keyword - string keyword name to looked up from a group, element value.
group, element - group and element value looked up from keyword.
Look up tag name for 0x10 0x10:
> name = dicomlookup(0x10,0x10) name = PatientName
Look up tag group and element value:
> [grp, elm] = dicomlookup('TransferSyntaxUID') grp = 2 elm = 16
See also: dicomdict.
image
= dicomread (filename)
¶image
= dicomread (structure)
¶Load the image from a DICOM file.
filename - a string giving the filename.*
structure - a structure with a field Filename
(such as returned by dicominfo
).
image - may be two or three dimensional, depending on the content of the file.
image - An integer or float matrix will be returned, the number of bits will depend on the file.
Load the image data of a dcm file:
> image = dicomread(file_in_loadpath('imdata/simple-test.dcm')) image = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
See also: dicominfo.
info =
dicomupdate(fileinfo, attribute, value)
¶info =
dicomupdate(info, attrinfo)
¶Update a dicom struct with new values
info - dicominfo struct.
attribute - attribute name to find and change value of.
value - attribute value to set.
attrinfo - a table with fields Location and Value for each matched attribute to change.
info - dicominfo struct.
filename = file_in_loadpath("imdata/rtstruct.dcm"); info = dicominfo(filename); % update specific values finfo = dicomfind(info, "ROINumber"); finfo.Value{1} = 10; info = dicomupdate(info, finfo); % update all matching info = dicomupdate(info, "ROINumber", 100);
filename)
¶filename, info)
¶Write a DICOM format file to filename.
im - image data or empty matrix, [], if only metadata save is required
filename - filename to write dicom to. if [], then function runs in verbose trial mode.
info - struct, like that produced by dicominfo
Create a dicom file using default info, and the supplied data:
> wdata = uint8 (10*rand (10,10)); > dicomwrite (wdata, 'test.dcm');
Create a dicom file using data and meta info:
> wdata = dicomread(file_in_loadpath('imdata/CT-MONO2-16-ankle.dcm'); > info = dicominfo(file_in_loadpath('imdata/CT-MONO2-16-ankle.dcm'); > dicomwrite(wdata, info);
See also: dicomread, dicominfo.
uidinfo
= images.dicom.decodeUID(uid)
¶Look up information about a uid string
uid - dicom uid string.
uidinfo - a structure with fields of Value, Name and Type.
Additional fields may be present in the case of a Transfer Syntax type uid.
> info = images.dicom.decodeUID("1.2.840.10008.1.1"); info = scalar structure containing the fields: Value = 1.2.840.10008.1.1 Name = Verification SOP Class Type = SOP Class
info
= images.dicom.parseDICOMDIR(filename)
¶Parse a DICOMDIR file and return the information as a struct.
filename - filename to open.
info - A struct containing the directory information from a DICOMDIR file
Th info structure will be an array of Patients, with an array of Studies with an array of Series with an array of Images.
Each element will contain a Payload field.
filename = file_in_loadpath("imdata/DICOMDIR"); info = images.dicom.parseDICOMDIR(filename);