[ImageJ-devel] Massive change of imglib merged into master

Stephan Preibisch preibisch at mpi-cbg.de
Fri Apr 16 04:21:42 CDT 2010

Hi everybody,

the massive changes Saalfeld and me did during the Hackathon are now
officially pushed to master. Most of the changes are not visible, only the
new hierarchy of numeric values:

NumericType <- ComplexType <- RealType <- IntegerType

Typically you can make your stuff running again by changing NumericType to
OutsideStrategy is now OutOfBoundsStrategy
CubeContainer is now CellContainer

I just want to comment on the idea behind it, for that I attach a document
that shows my Skype discussion with Albert for now who had to adapt his code
for the new structure ... I think that conversation was not so bad as Albert
points out at the end :)

Have fun,
Stephan & Stephan

[4/13/2010 3:39:24 AM] Albert Cardona: Stephan
[4/13/2010 3:39:29 AM] Albert Cardona: generics issues with imglib
[4/13/2010 3:39:39 AM] Albert Cardona: can you check your email? I am stuck
in a huge code mess because of it
[4/13/2010 3:39:49 AM] Albert Cardona: would help me move on
[4/13/2010 3:41:52 AM] Stephan Preibisch: hi albert
[4/13/2010 3:42:09 AM] Stephan Preibisch: this is the new numeric type
structure we did in heidelberg
[4/13/2010 3:42:13 AM] Albert Cardona: sure
[4/13/2010 3:42:17 AM] Albert Cardona: and how is it used?
[4/13/2010 3:42:29 AM] Stephan Preibisch: NumericType <- ComplexType <-
RealType <- IntegerType
[4/13/2010 3:42:31 AM] Albert Cardona: is it documented somewhere? I need to
adapt two classes from old to new
[4/13/2010 3:42:46 AM] Stephan Preibisch: simply replace NumericType with <T
extends RealType<T>
[4/13/2010 3:42:49 AM] Albert Cardona: ij3d.ImgLibVolume and Jean Yves'
[4/13/2010 3:42:59 AM] Albert Cardona: ok
[4/13/2010 3:43:00 AM] Stephan Preibisch: <T extends NumericType<T> with <T
extends RealType<T>
[4/13/2010 3:43:00 AM] Albert Cardona: doing that
[4/13/2010 3:43:53 AM] Stephan Preibisch: and for the ShapeContainer
[4/13/2010 3:43:55 AM] Albert Cardona: so ComplexType is not a RealType
[4/13/2010 3:44:06 AM] Stephan Preibisch: no it is not
[4/13/2010 3:44:15 AM] Stephan Preibisch: RealType is a specialization of
[4/13/2010 3:44:19 AM] Albert Cardona: ok
[4/13/2010 3:44:26 AM] Stephan Preibisch: OutsideStrategy
[4/13/2010 3:44:33 AM] Stephan Preibisch: is now OutOfBoundsStrategy
[4/13/2010 3:44:39 AM] Albert Cardona: I saw it
[4/13/2010 3:45:30 AM] Albert Cardona: thanks
[4/13/2010 3:45:39 AM] Stephan Preibisch: no problem :)
[4/13/2010 3:45:47 AM] Albert Cardona: so RealType doesn't have a getReal()
[4/13/2010 3:45:52 AM] Albert Cardona: so what does it have to get a float?
[4/13/2010 3:45:58 AM] Stephan Preibisch: getRealFloat()
[4/13/2010 3:46:06 AM] Stephan Preibisch: or getRealDouble()
[4/13/2010 3:46:06 AM] Albert Cardona: ugh
[4/13/2010 3:46:09 AM] Albert Cardona: that's ugly
[4/13/2010 3:46:20 AM] Albert Cardona: getFloat and getDouble would do no?
[4/13/2010 3:46:22 AM] Stephan Preibisch: no, necessary as Java does not
[4/13/2010 3:46:45 AM] Stephan Preibisch: for setting it works without
[4/13/2010 3:47:01 AM] Stephan Preibisch: we did not want to enforce to
having to compute with Doubles
[4/13/2010 3:47:10 AM] Albert Cardona: I just complain about the names
[4/13/2010 3:47:12 AM] Albert Cardona: so long
[4/13/2010 3:47:15 AM] Albert Cardona: and redundant
[4/13/2010 3:47:17 AM] Stephan Preibisch: no
[4/13/2010 3:47:22 AM] Albert Cardona: a Float is a Real, so why
[4/13/2010 3:47:34 AM] Stephan Preibisch: because there is also a
[4/13/2010 3:47:39 AM] Albert Cardona: is like saying getRealFloatNumber
[4/13/2010 3:47:45 AM] Stephan Preibisch: getComplexFloat()
[4/13/2010 3:47:52 AM] Stephan Preibisch: getRealFloat()
[4/13/2010 3:47:55 AM] Albert Cardona: uf
[4/13/2010 3:48:05 AM] Albert Cardona: very verbose, but whatever
[4/13/2010 3:48:11 AM] Albert Cardona: is not like I can change it
[4/13/2010 3:48:30 AM] Stephan Preibisch: but getFloat() is not clear
[4/13/2010 3:48:40 AM] Stephan Preibisch: if it is the complex or the real
[4/13/2010 3:49:29 AM] Albert Cardona: getComplexFloat returns what?
[4/13/2010 3:49:33 AM] Albert Cardona: a Complex number?
[4/13/2010 3:49:37 AM] Albert Cardona: or just the complex part of the
[4/13/2010 3:50:05 AM] Stephan Preibisch: the idea is ( how it really is )
[4/13/2010 3:50:18 AM] Stephan Preibisch: a real number is also a complex
[4/13/2010 3:50:22 AM] Stephan Preibisch: a subset of it
[4/13/2010 3:50:29 AM] Albert Cardona: hum yes
[4/13/2010 3:50:29 AM] Albert Cardona: true
[4/13/2010 3:50:31 AM] Stephan Preibisch: RealType extends ComplexType
[4/13/2010 3:50:51 AM] Albert Cardona: so getComplexFloat returns 0 for just
real numbers.
[4/13/2010 3:51:02 AM] Stephan Preibisch: exactly
[4/13/2010 3:51:02 AM] Albert Cardona: i..e the complex part is o * i
[4/13/2010 3:51:06 AM] Stephan Preibisch: yes
[4/13/2010 3:51:09 AM] Albert Cardona: ok
[4/13/2010 3:51:12 AM] Albert Cardona: got ti
[4/13/2010 3:51:20 AM] Stephan Preibisch: and the math you write for complex
stuff is still correct and works
[4/13/2010 3:51:29 AM] Albert Cardona: xD
[4/13/2010 3:51:35 AM] Albert Cardona: generic image library indeed.
[4/13/2010 3:51:46 AM] Stephan Preibisch: so math for complex numbers should
work on real numbers
[4/13/2010 3:51:50 AM] Stephan Preibisch: and it does
[4/13/2010 3:52:04 AM] Stephan Preibisch: it is just a specialization
[4/13/2010 3:52:15 AM] Stephan Preibisch: and integerType is even more
[4/13/2010 3:52:38 AM] Stephan Preibisch: but you can still treat it like a
real type
[4/13/2010 3:52:55 AM] Stephan Preibisch: it will just not be stored with
high precision
[4/13/2010 3:53:06 AM] Albert Cardona: woah
[4/13/2010 3:53:13 AM] Albert Cardona: be sure to document all that :)
[4/13/2010 3:53:18 AM] Albert Cardona: it's good, but it's also a gotcha
[4/13/2010 3:53:31 AM] Stephan Preibisch: by that, a gaussian convolution
for example is written for RealType
[4/13/2010 3:53:51 AM] Stephan Preibisch: and works on Integer Types as
well, computing with Doubles internally but saving as ints
[4/13/2010 3:55:00 AM] Stephan Preibisch: but there is still some
documentation needed indeed 
[4/13/2010 3:55:49 AM] Albert Cardona: lots of :)
[4/13/2010 3:55:56 AM] Albert Cardona: the above explanations were very
clear Stephan
[4/13/2010 3:56:00 AM] Albert Cardona: just copy paste them to the wiki :)

More information about the ImageJ-devel mailing list