CONFOCALMICROSCOPY Archives

February 2009

CONFOCALMICROSCOPY@LISTS.UMN.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Johan Henriksson <[log in to unmask]>
Reply To:
Confocal Microscopy List <[log in to unmask]>
Date:
Tue, 3 Feb 2009 22:23:07 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (59 lines)
I'm in the midst of finally deciding how to deal with different pixel
formats in my program (eg 8bit, 16bit). it's a pain-staking trade-off
and I wish to start a discussion here to get the best result. I am
grateful for responses from both users and commercial/open source
developers.

one one hand: performance is higher if the right format is used. 8bit
takes half the memory of 16bit, transfer is 100% faster.

on the other hand: we have unsigned 8bit, 12bit, 16bit, 32bit, signed
8bit, 12bit, 16bit, 32bit, float, double, 8bit palette color, 5+6+5
packed color, HD formats etc.

that's 10+ formats!! if you write an algorithm, you need to produce 10
versions of it. sometimes conversion is needed with potential loss of
information. for every format we can slay, complexity is reduced. less
complexity means fewer bugs and more features faster.

so what are everyones position on this? here is mine:

* the need of easy scientific manipulation is totally separate from fast
rendering. packed formats and other arcane solutions belong in games only.
* we need floating point for calculations. having both float and double
is a minor complication since the range is "virtually the same".
* we need integers because algorithms like levelsets are based on a
proper ordering of numbers. it's possible but hard to do in floating
point. storage of common images is simplified in integer since many
compression algorithms relies on the quantization.
* even trivial operations like subtract and laplace spit out negative
numbers. java does not cope well with unsigned integers and conversion
to signed ones is messy. hence all formats should be signed. in
particular, all unsigned integers should be banned. this is a radical
decision!!
* supporting 4 integer formats is as easy as supporting 2 but not as
easy as only 1. if we go for 1, it should be 16bit or 32bit.
* metaprogramming is the only way out to support all formats with kept
performance. most programmers do not know it and many languages do not
have built-in support for it.

how do we deal with all the unsigned data in existence? most is unsigned
8bit to my knowledge. drop one bit to fit it in 7? put it in 16bit? Here
I would say use 16.

for 16bit data, dropping 1 bit does not hurt that much. I want to know,
how many does actually use the entire range of 16 bits? a loss of
0.00001% precision is not much to cry for.

once again, thankful for any comments
/Johan


-- 
--
------------------------------------------------
Johan Henriksson
MSc Engineering
PhD student, Karolinska Institutet
http://mahogny.areta.org http://www.endrov.net

ATOM RSS1 RSS2