view scripts/io/Tiff.m @ 31092:a736190ce738

Added the Tiff classdef files to octave
author magedrifaat <magedrifaat@gmail.com>
date Fri, 17 Jun 2022 16:53:43 +0200
parents
children ab5b33e447b0
line wrap: on
line source

classdef Tiff
    properties (Constant = true)
        TagID = struct(
            "ImageWidth", 256,
            "ImageLength", 257,
            "BitsPerSample", 258,
            "Compression", 259,
            "PhotometricInterpretation", 262,
            "StripOffsets", 273,
            "SamplesPerPixel", 277,
            "RowsPerStrip", 278,
            "StripByteCounts", 279,
            "XResolution", 282,
            "YResolution", 283,
            "ResolutionUnit", 296,
            "ColorMap", 320
        )
    endproperties

    properties (Access = private)
        tiff_handle
    endproperties

    methods
        function t = Tiff(filename, mode="r")
            if (nargin == 0 || nargin > 2)
                % print_usage();
                error("Usage: Tiff(filename[, mode])");
            endif

            t.tiff_handle = __open_tiff__(filename, mode);
        endfunction

        function close(t)
            __close_tiff__(t.tiff_handle);
        endfunction

        function tag = getTag(t, tagName)
            tag = __tiff_get_tag__(t.tiff_handle, tagName);
        endfunction

        % TODO(maged): implement a print_usage
    endmethods
endclassdef