Packages

 

com.aspose.imaging.imageoptions

Class DicomOptions

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public class DicomOptions
    extends ImageOptionsBase

    The DICOM file format creation options.

    Code example:

    The following example shows export to DICOM file format (single and multipage).


    String fileName = "sample.jpg";
    String inputFileNameSingle = fileName;
    String inputFileNameMultipage = "multipage.tif";
    String outputFileNameSingleDcm = "output.dcm";
    String outputFileNameMultipageDcm = "outputMultipage.dcm";
    
    // The next code sample converts JPEG image to DICOM file format
    try(com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputFileNameSingle))
    {
        image.save(outputFileNameSingleDcm, new com.aspose.imaging.imageoptions.DicomOptions());
    }
    
    // DICOM format supports multipage images. You can convert GIF or TIFF images to DICOM in the same way as JPEG images
    try(com.aspose.imaging.Image imageMultiple = com.aspose.imaging.Image.load(inputFileNameMultipage))
    {
        imageMultiple.save(outputFileNameMultipageDcm, new com.aspose.imaging.imageoptions.DicomOptions());
    }
    

    • Constructor Detail

      • DicomOptions

        public DicomOptions()

        Initializes a new instance of the DicomOptions class.

    • Method Detail

      • getCompression

        public final Compression getCompression()

        Gets the compression.

        Value: The compression.
        Returns:
        the compression.
      • setCompression

        public final void setCompression(Compression value)

        Sets the compression.

        Value: The compression.
        Parameters:
        value - the compression.
      • getColorType

        public final int getColorType()

        Gets the type of the color.

        Value: The type of the color.
        Returns:
        the type of the color.
      • setColorType

        public final void setColorType(int value)

        Sets the type of the color.

        Value: The type of the color.
        Parameters:
        value - the type of the color.
        Code example:

        Use JPEG compression in DICOM image.


        try (Image inputImage = Image.load("original.jpg"))
        {
            DicomOptions options = new DicomOptions();
            options.setColorType(ColorType.Rgb24Bit);
        
            Compression compression = new Compression();
            compression.setType(CompressionType.Jpeg);
            JpegOptions jpegOptions = new JpegOptions();
            jpegOptions.setCompressionType(JpegCompressionMode.Baseline);
            jpegOptions.setSampleRoundingMode(SampleRoundingMode.Truncate);
            jpegOptions.setQuality(50);
            compression.setJpeg(jpegOptions);
        
            options.setCompression(compression);
        
            inputImage.save("original_JPEG.dcm", options);
        }