DicomOptions Klasse
Summary: The API for Digital Imaging and Communications in Medicine (DICOM) raster image
format creation is a specialized tool tailored for medical device applications.
It enables the seamless generation of DICOM images, crucial for storing medical
data and containing vital identification information. With features to
and set compression, define color types, and embed XMP metadata, developers
can ensure compliance and flexibility in managing DICOM images for medical
imaging purposes.
Module: aspose.imaging.imageoptions
Full Name: aspose.imaging.imageoptions.DicomOptions
Inheritance: IMetadataContainer, IHasExifData, IHasMetadata, IHasXmpData, ImageOptionsBase
Constructors
| Name | Beschreibung |
|---|---|
| DicomOptions() | Initialisiert eine neue Instanz der DicomOptions Klasse. |
Properties
| Name | Type | Access | Beschreibung |
|---|---|---|---|
| buffer_size_hint | int | r/w | Liest oder setzt den Hinweis zur Puffergröße, der die maximal zulässige Größe für alle internen Puffer definiert. |
| color_type | ColorType | r/w | Liest oder setzt den Typ der Farbe. |
| compression | Compression | r/w | Liest oder setzt die Kompression. |
| freigegeben | bool | r | Liest einen Wert, der angibt, ob diese Instanz freigegeben ist. |
| exif_data | ExifData | r/w | Liest oder setzt die Exif-Daten. |
| full_frame | bool | r/w | Liest oder setzt einen Wert, der angibt, ob [full frame]. |
| keep_metadata | bool | r/w | Liest einen Wert, ob die ursprünglichen Bildmetadaten beim Export beibehalten werden sollen. |
| multi_page_options | MultiPageOptions | r/w | Die Mehrseiten‑Optionen |
| palette | IColorPalette | r/w | Liest oder setzt die Farbpalette. |
| resolution_settings | ResolutionSetting | r/w | Liest oder setzt die Auflösungseinstellungen. |
| source | Source | r/w | Liest oder setzt die Quelle, in der das Bild erstellt wird. |
| vector_rasterization_options | VectorRasterizationOptions | r/w | Liest oder setzt die Vektor‑Rasterisierungsoptionen. |
| xmp_data | XmpPacketWrapper | r/w | Liest oder setzt den XMP‑Metadatencontainer. |
Methods
| Name | Beschreibung |
|---|---|
| clone() | Erstellt eine memberweise Kopie dieser Instanz. |
| try_set_metadata(metadata) | Versucht, eine metadata-Instanz zu setzen, falls diese Image‑Instanz unterstützt und eine IImageMetadataFormat‑Instanz implementiert. |
Constructor: DicomOptions()
DicomOptions()
Initialisiert eine neue Instanz der DicomOptions Klasse.
Property: color_type
Liest oder setzt den Typ der Farbe.
See also:
Example # 1: Use JPEG compression in DICOM image.
Example # 2: Use JPEG 2000 compression in DICOM image.
Example # 3: Use RLE compression in DICOM image.
Example # 4: Change the color type in DICOM compression.
Property: compression
Liest oder setzt die Kompression.
See also:
Example # 1: Use JPEG compression in DICOM image.
Example # 2: Use JPEG 2000 compression in DICOM image.
Example # 3: Use RLE compression in DICOM image.
Example # 4: Change the color type in DICOM compression.
Method: clone()
clone()
Erstellt eine memberweise Kopie dieser Instanz.
Returns
| Typ | Beschreibung |
|---|---|
| ImageOptionsBase | Eine memberweise Kopie dieser Instanz. |
Method: try_set_metadata(metadata)
try_set_metadata(metadata)
Versucht, eine metadata-Instanz zu setzen, falls diese Image‑Instanz unterstützt und eine IImageMetadataFormat‑Instanz implementiert.
Parameters:
| Parameter | Typ | Beschreibung |
|---|---|---|
| metadata | IImageMetadataFormat | Die Metadaten. |
Returns
| Typ | Beschreibung |
|---|---|
| bool | True, wenn die IMetadataContainer Instanz unterstützt und/oder das IImageMetadataFormat implementiert; andernfalls false. |
Examples
The following example shows export to DICOM file format (single and multipage).
from aspose.imaging import Image
from aspose.imaging.imageoptions import DicomOptions
fileName = "sample.jpg"
inputFileNameSingle = fileName
inputFileNameMultipage = "multipage.tif"
outputFileNameSingleDcm = "output.dcm"
outputFileNameMultipageDcm = "outputMultipage.dcm"
# Das nächste Codebeispiel konvertiert ein JPEG‑Bild in das DICOM‑Dateiformat.
with Image.load(inputFileNameSingle) as image:
image.save(outputFileNameSingleDcm, DicomOptions())
# Das DICOM‑Format unterstützt mehrseitige Bilder. Sie können GIF‑ oder TIFF‑Bilder auf dieselbe Weise wie JPEG‑Bilder in DICOM konvertieren.
with Image.load(inputFileNameMultipage) as image_multiple:
image_multiple.save(outputFileNameMultipageDcm, DicomOptions())
Use JPEG compression in DICOM image.
import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.imageoptions import JpegOptions, DicomOptions
from aspose.imaging.fileformats.jpeg import JpegCompressionMode, SampleRoundingMode
from aspose.imaging.imageoptions import DicomOptions
from aspose.imaging.fileformats.dicom import Compression, ColorType, CompressionType
with Image.load("original.jpg") as input_image:
obj_init = JpegOptions()
obj_init.compression_type = JpegCompressionMode.BASELINE
obj_init.sample_rounding_mode = SampleRoundingMode.TRUNCATE
obj_init.quality = 50
obj_init2 = Compression()
obj_init2.type = CompressionType.JPEG
obj_init2.jpeg = obj_init
options = DicomOptions()
options.color_type = ColorType.RGB_24_BIT
options.compression = obj_init2
input_image.save("original_JPEG.dcm", options)
Use JPEG 2000 compression in DICOM image.
import aspose.pycore as aspycore
from aspose.imaging import Image
from aspose.imaging.imageoptions import Jpeg2000Options, DicomOptions
from aspose.imaging.fileformats.jpeg2000 import Jpeg2000Codec, Compression, CompressionType, ColorType
with Image.load("original.jpg") as input_image:
obj_init = Jpeg2000Options()
obj_init.codec = Jpeg2000Codec.JP2
obj_init.irreversible = False
obj_init2 = Compression()
obj_init2.type_ = CompressionType.JPEG2000
obj_init2.jpeg2000 = obj_init
options = DicomOptions()
options.color_type = ColorType.RGB_24_BIT
options.compression = obj_init2
input_image.save("original_JPEG2000.dcm", options)
Use RLE compression in DICOM image.
from aspose.imaging import Image
from aspose.imaging.fileformats.dicom import Compression, CompressionType, ColorType
from aspose.imaging.imageoptions import DicomOptions
with Image.load("original.jpg") as input_image:
compr = Compression()
compr.type_ = CompressionType.RLE
options = DicomOptions()
options.color_type = ColorType.RGB_24_BIT
options.compression = compr
input_image.save("original_RLE.dcm", options)
Change the color type in DICOM compression.
from aspose.imaging import Image
from aspose.imaging.imageoptions import DicomOptions
from aspose.imaging.fileformats.dicom import ColorType
with Image.load("original.jpg") as inputImage:
options = DicomOptions()
options.color_type = ColorType.GRAYSCALE_8_BIT
inputImage.save("original_8Bit.dcm", options)