PAWT 1.1.4 Reference Manual

::pawt::flirTop, Main, Index

CommandsTop, Main, Index

ReadImageFile [::pawt::flir]Top, Main, Index

Read a FLIR image file into a dictionary.

ReadImageFile flirImgFile ?args?
Parameters
flirImgFileFile name of the FLIR image.
argsOptional format specific arguments. Currently none.
Description

Get the image data as a dictionary containing 2 keys: Header and Data.

Return value

Returns the image information as a dictionary. If the file does not exist or no supported image format can be detected, an error is thrown.

See also

ReadImageHeader

proc ::pawt::flir::ReadImageFile {flirImgFile args} {

    # Read a FLIR image file into a dictionary.
    #
    # flirImgFile - File name of the FLIR image.
    # args        - Optional format specific arguments. Currently none.
    #
    # Get the image data as a dictionary containing 2 keys: `Header` and `Data`.
    # * See [::pawt::ReadImageHeader] for the entries of the `Header` key.
    # * See [::pawt::ReadImageFile] for the entries of the `Data` key.
    #
    # Returns the image information as a dictionary.
    # If the file does not exist or no supported image format can be detected,
    # an error is thrown.
    #
    # See also: ReadImageHeader

    set retVal [catch {open $flirImgFile "r"} fp]
    if { $retVal != 0 } {
        error "Cannot open file $flirImgFile"
    }
    fconfigure $fp -translation binary

    set imgDict [dict create]
    set headerDict [_GetImageHeader $fp [file tail $flirImgFile]]
    _GetImageData $fp $headerDict imgDict
    dict append imgDict Header $headerDict

    close $fp
    return $imgDict
}

ReadImageHeader [::pawt::flir]Top, Main, Index

Read the header of a FLIR image file.

ReadImageHeader flirImgFile ?args?
Parameters
flirImgFileFile name of the FLIR image.
argsOptional format specific arguments. Currently none.
Description

See ::pawt::ReadImageHeader for the default entries of a header dictionary.

Return value

Returns the header information as a dictionary. If the file does not exist or the header contains invalid information, an error is thrown.

See also

ReadImageFile, WriteImageFile

proc ::pawt::flir::ReadImageHeader {flirImgFile args} {

    # Read the header of a FLIR image file.
    #
    # flirImgFile - File name of the FLIR image.
    # args        - Optional format specific arguments. Currently none.
    #
    # See [::pawt::ReadImageHeader] for the default entries of a
    # header dictionary.
    #
    # Returns the header information as a dictionary.
    # If the file does not exist or the header contains invalid information,
    # an error is thrown.
    #
    # See also: ReadImageFile WriteImageFile

    set retVal [catch {open $flirImgFile "r"} fp]
    if { $retVal != 0 } {
        error "Cannot open file $flirImgFile"
    }
    fconfigure $fp -translation binary
    set headerDict [_GetImageHeader $fp [file tail $flirImgFile]]
    close $fp
    return $headerDict
}

WriteImageFile [::pawt::flir]Top, Main, Index

Write the values of an image dict into a FLIR image file.

WriteImageFile imgDict flirImgFile ?args?
Parameters
imgDictImage dictionary.
flirImgFileFile name of the image.
argsOptional format specific arguments. Currently none.
Description

See ::pawt::WriteImageFile for general informations regarding writing images.

Return value

Returns no value. If invalid options are specified or the file could not be written, an error is thrown.

See also

ReadImageFile, ReadImageHeader

proc ::pawt::flir::WriteImageFile {imgDict flirImgFile args} {

    # Write the values of an image dict into a FLIR image file.
    #
    # imgDict     - Image dictionary.
    # flirImgFile - File name of the image.
    # args        - Optional format specific arguments. Currently none.
    #
    # See [::pawt::WriteImageFile] for general informations regarding writing images.
    #
    # Returns no value. If invalid options are specified or the file could not
    # be written, an error is thrown.
    #
    # See also: ReadImageFile ReadImageHeader

    set retVal [catch {open $flirImgFile "w"} fp]
    if { $retVal != 0 } {
        error "Cannot open output file $flirImgFile"
    }
    fconfigure $fp -translation binary

    _PutImageHeader $fp [dict get $imgDict Header]
    _PutImageData   $fp imgDict
    close $fp
}