/usr/share/gnudatalanguage/lib/read_tiff.pro is in libgnudatalanguage0 0.9.7-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | ;$Id: read_tiff.pro,v 1.4 2014/08/10 06:54:54 alaingdl Exp $
;
function READ_TIFF, filename, red, green, blue, channels=channels, $
geotiff=geotiff, image_index=image_index, $
interleave=interleave, orientation=orientation, $
planarconfig=planarconfig, sub_rect=sub_rect, $
verbose=verbose
;+
;
;
;
; NAME: READ_TIFF
;
; PURPOSE: Reads a tiff file into memory
;
; CATEGORY: Images (IO)
;
; CALLING SEQUENCE: image=read_tiff(filename,r,g,b)
;
; KEYWORD PARAMETERS:
; CHANNELS: (scalar or vector) specify which channels to
; retrieve
; GEOTIFF: Returns a geotiff structure
; IMAGE_INDEX: select the image number to read
; INTERLEAVE: pixel:0, row:1, column: 2
; ORIENTATION: Named variable whose value depends on the
; rotation of the image in the file
; row 0, column 0 is
; 0- bottom left
; 1- top left
; 2- top right
; 3- bottom right
; 4- bottom left
; 5- left top
; 6- right top
; 7- right bottom
; 8- left bottom
;
; PLANARCONFIG: Named variable describing the interleave of the
; file
; SUB_RECT : Four element vector describing the sub rectangle
; to read in [x,y,width,height], from the lower left
; hand corner
; VERBOSE: Be more verbose
;
;
; OUTPUTS: For true color images, data is a three dimensional array
; with interleaving set by the INTERLEAVE keyword
;
; OPTIONAL OUTPUTS: For pseudocolor only
; red : the Red colormap vector (for PseudoColor images)
; green: the Green colormap vector (for PseudoColor images)
; blue : the Blue colormap vector (for PseudoColor images)
;
; RESTRICTIONS:
; Requires ImageMagick
;
; PROCEDURE:
; Use ImageMagick to read the data as requested
;
; EXAMPLE:
;
; MODIFICATION HISTORY:
; Written by: Christopher Lee 2004-05-23
; Small revision by Alain Coulais, 2014-08-09
;
;-
; LICENCE:
; Copyright (C) 2004, 2014
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
;
;-
;
ON_ERROR, 2
;
; this line allows to compile also in IDL ...
FORWARD_FUNCTION MAGICK_READ
;
;
; Do we have access to ImageMagick functionnalities ??
;
if (MAGICK_EXISTS() EQ 0) then begin
MESSAGE, /continue, "GDL was compiled without ImageMagick support."
MESSAGE, "You must have ImageMagick support to use this functionaly."
endif
if (N_ELEMENTS(filename) GT 1) then MESSAGE, "Only one file at once !"
f=filename
if(keyword_set(IMAGE_INDEX)) then f=filename+"["+string(IMAGE_INDEX)+"]"
mid=magick_open(f)
;if(keyword_set(VERBOSE)) then message, "VERBOSE Keyword not used yet."
;message, "Orientation and planarconfig may not be accurate."
print, "Orientation and planarconfig may not be accurate."
orientation=0
planarconfig=1
if(magick_IndexedColor(mid)) then begin
image=magick_readIndexes(mid)
magick_readcolormapRGB,mid,red,green,blue
colortable=[[red],[green],[blue]]
endif else begin
m=["R","G","B","A"]
if(n_elements(channels)) then begin
map=m[channels]
endif
image=magick_read(mid,sub_rect=sub_rect)
if(keyword_set(interleave)) then begin
if (interleave eq 0) then image=transpose(image, [0,1,2])
if (interleave eq 1) then image=transpose(image, [1,0,2])
if (interleave eq 2) then image=transpose(image, [1,2,0])
endif
endelse
magick_close,mid
return,image
end
|