Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-j.b-one.net (mx-j.one.com [91.198.169.57])
	by mail9.b-one.net (Postfix) with ESMTP id F2FE6400164
	for <info@awaresystems.be>; Wed,  8 Sep 2010 22:47:03 +0200 (CEST)
Received: by mx-j.b-one.net (Postfix, from userid 106)
	id E754A50027; Wed,  8 Sep 2010 22:47:03 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Spam-Flag: NO
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=4 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-j.b-one.net (Postfix) with ESMTP id DFC3B50027 for <info@awaresystems.be>;
 Wed,  8 Sep 2010 22:47:02 +0200 (CEST)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id DEC961D184BD3; Wed,  8 Sep 2010
 15:46:13 -0500 (EST)
Received: from mail-ew0-f44.google.com (mail-ew0-f44.google.com
 [209.85.215.44]) by lists.maptools.org (Postfix) with ESMTP id 6A4651D184BD1
 for <tiff@lists.maptools.org>; Wed,  8 Sep 2010 15:45:14 -0500 (EST)
Received: by ewy22 with SMTP id 22so412009ewy.3 for
 <tiff@lists.maptools.org>; Wed, 08 Sep 2010 13:45:13 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.14.119.5 with SMTP id m5mr906375eeh.19.1283978713329; Wed, 08
 Sep 2010 13:45:13 -0700 (PDT)
Received: by 10.14.127.207 with HTTP; Wed, 8 Sep 2010 13:45:13 -0700 (PDT)
In-Reply-To: <alpine.GSO.2.01.1009081504070.12887@freddy.simplesystems.org>
References: <AANLkTikfojjptNww2kZk4z8eNX4KKC8xsHPw1zbKFVwz@mail.gmail.com>
 <alpine.GSO.2.01.1009081359300.12887@freddy.simplesystems.org>
 <AANLkTimyKqYXxJ5ezD6feP_pBqn4PtzDcj=SPsRM668c@mail.gmail.com>
 <alpine.GSO.2.01.1009081504070.12887@freddy.simplesystems.org>
Date: Wed, 8 Sep 2010 16:45:13 -0400
Message-ID: <AANLkTinZsoDbK8czY7e2+dMAoSF=S36P=eXJBRSSE6z7@mail.gmail.com>
From: Olivier Paquet <olivier.paquet@gmail.com>
To: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
Cc: TIFF mailing list <tiff@lists.maptools.org>
Subject: Re: [Tiff] broken interface for TIFFTAG_SMINSAMPLEVALUE
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

On Wed, Sep 8, 2010 at 4:13 PM, Bob Friesenhahn
<bfriesen@simple.dallas.tx.us> wrote:
> On Wed, 8 Sep 2010, Olivier Paquet wrote:
>>
>> Ok. Out of curiosity, do you have a use for which a single value for
>> all channels is fine? Are you dealing with single channel images?
>
> These tags are just a usage 'hint'. =A0If there are three channels, then I
> simply specify values which represent the maximum range (e.g. 0.0 to 1.0)
> when considering all three channels. =A0The values set are not evaluated =
by

I considered something like this... but it breaks down when I have to
deal with an alpha channel. I either have to lie (not consider the
alpha channel) or end up with the range pretty much always being
[0,1]. Besides, I could also have a real need for per channel values
if the "color" image is really 3 independent values crammed into a
single "image". And I can imagine uses for knowing the actual range of
the alpha too.

> finding the actual max/min of the data. =A0Except for scientific applicat=
ions,
> knowing the normal range of the data may be more useful than knowing the
> actual range since usually the channels are related to each other.

Depends a lot on the application. This isn't something libtiff should
have decided though. But it's too late to change that :)

>>> Perhaps it is better to add new functions which support access to
>>> channel-specific tags?
>>[...]
>
> A channel parameter seems best.

So we'd have something like:

extern int TIFFGetFieldSample(TIFF* tif, uint32 tag, uint32 sample, ...);
extern int TIFFVGetFieldSample(TIFF* tif, uint32 tag, uint32 sample,
va_list ap);
extern int TIFFSetFieldSample(TIFF* tif, uint32 tag, uint32 sample, ...);
extern int TIFFVSetFieldSample(TIFF* tif, uint32 tag, uint32 sample,
va_list ap);

>> In the more hackish category, we could also have a flag which we'd or
>> with the tag number to tell libtiff we want it per-channel. Something
>> like TIFFGetField( tif, TIFFTAG_SMINSAMPLEVALUE, ... ) for the old
>> behavior and TIFFGetField( tif, TIFFTAG_SMINSAMPLEVALUE |
>> TIFFTAG_PERSAMPLE, ... ) to get the tag as an array of SamplesPerPixel
>> values. This would seem to be the least disruptive option but it
>> introduces a new meaning for the tag parameter (we have tags and
>> pseudo tags but nothing which gets or'ed together AFAIK).
>
> This may be least disruptive for existing users, but perhaps not in libti=
ff.

Either solution will require the directory structure to store all the
values (it currently holds only one). This implies changing the old
code in TIFFGetField/TIFFSetField (probably "fixing" it to return the
min/max of all channels). The only difference is adding new API entry
points vs adding two cases in a switch.

> Note that specifying per channel values won't make them available to the
> 99.999% of the world which won't expect or use them.

99.99% of the world will already not be able to get to the image
anyway (multiple directories, tiled, often 16-bit int or 32-bit
float). Anyone who might end up caring about that metadata will either
figure it out or ask us.

Olivier
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
