Introduc)on to ImgLib2 Stephan Preibisch, Tobias Pietzsch, - - PowerPoint PPT Presentation

introduc on to imglib2
SMART_READER_LITE
LIVE PREVIEW

Introduc)on to ImgLib2 Stephan Preibisch, Tobias Pietzsch, - - PowerPoint PPT Presentation

Introduc)on to ImgLib2 Stephan Preibisch, Tobias Pietzsch, Stephan Saalfeld Albert Einstein College of Medicine, New York MPI-CBG, Dresden, Germany HHMI


slide-1
SLIDE 1

Introduc)on ¡to ¡ImgLib2 ¡

Stephan ¡Preibisch, ¡Tobias ¡Pietzsch, ¡Stephan ¡Saalfeld ¡

¡

Albert ¡Einstein ¡College ¡of ¡Medicine, ¡New ¡York ¡ MPI-­‑CBG, ¡Dresden, ¡Germany ¡ HHMI ¡Janelia ¡Farm ¡Research ¡Campus, ¡Virginia ¡

slide-2
SLIDE 2

Special ¡thanks ¡to ¡… ¡

  • Tobias ¡Pietzsch ¡(MPI-­‑CBG) ¡
  • Stephan ¡Saalfeld ¡(MPI-­‑CBG) ¡

¡

  • Pavel ¡Tomancak ¡(MPI-­‑CBG) ¡
  • Gene ¡Myers ¡(MPI-­‑CBG) ¡
  • Rob ¡Singer ¡ ¡

(Einstein ¡College ¡& ¡Janelia ¡Farm) ¡

  • ImageJ2 ¡crew ¡

– Johannes ¡Schindelin ¡ – Cur)s ¡Rueden ¡ – Barry ¡DeZonia ¡ – Kevin ¡Eliceiri ¡

  • Albert ¡Cardona ¡
  • KNIME ¡guys ¡

– Chris)an ¡Dietz ¡ – Mar)n ¡Horn ¡

slide-3
SLIDE 3

ImgLib2 ¡paper ¡is ¡finally ¡out ¡… ¡

slide-4
SLIDE 4

Why ¡using ¡ImgLib2? ¡

  • Generic ¡programming ¡– ¡Write ¡it ¡once! ¡
  • Directly ¡applicable ¡to ¡very ¡large ¡datasets, ¡

different ¡dimensionality ¡or ¡pixel ¡type ¡

  • ImgLib2 ¡does ¡not ¡force ¡you ¡to ¡implement ¡type ¡

independent ¡or ¡n-­‑dimensional ¡– ¡it ¡is ¡s)ll ¡ applicable ¡to ¡very ¡large ¡datasets ¡

  • More ¡algorithm-­‑like ¡programming ¡
  • Fewer ¡simple ¡programming ¡mistakes ¡
  • Easier ¡exchange ¡of ¡code ¡
  • Smaller ¡source ¡code ¡
slide-5
SLIDE 5

ImagePlus ¡

slide-6
SLIDE 6

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

slide-7
SLIDE 7

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

T:RealType ¡

slide-8
SLIDE 8

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

FloatType ¡

¡

+get(): ¡float ¡ +set(value: ¡float) ¡ +copy(): ¡FloatType ¡

slide-9
SLIDE 9

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡ T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

FloatType ¡

¡

+get(): ¡float ¡ +set(value: ¡float) ¡ +copy(): ¡FloatType ¡

slide-10
SLIDE 10

RandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:int[]) ¡ +setPosiJon(posiJon:long[]) ¡ +setPosiJon(pos:int, ¡d:int) ¡ +setPosiJon(pos:long, ¡d:int) ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡ T:RealType ¡ T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

FloatType ¡

¡

+get(): ¡float ¡ +set(value: ¡float) ¡ +copy(): ¡FloatType ¡

slide-11
SLIDE 11

RandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:int[]) ¡ +setPosiJon(posiJon:long[]) ¡ +setPosiJon(pos:int, ¡d:int) ¡ +setPosiJon(pos:long, ¡d:int) ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡ T:RealType ¡ T:RealType ¡

ImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

FloatType ¡

¡

+get(): ¡float ¡ +set(value: ¡float) ¡ +copy(): ¡FloatType ¡

slide-12
SLIDE 12

RandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:int[]) ¡ +setPosiJon(posiJon:long[]) ¡ +setPosiJon(pos:int, ¡d:int) ¡ +setPosiJon(pos:long, ¡d:int) ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡ T:RealType ¡ T:RealType ¡

ImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

OutOfBoundsStrategy ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

FloatType ¡

¡

+get(): ¡float ¡ +set(value: ¡float) ¡ +copy(): ¡FloatType ¡

slide-13
SLIDE 13

RandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:int[]) ¡ +setPosiJon(posiJon:long[]) ¡ +setPosiJon(pos:int, ¡d:int) ¡ +setPosiJon(pos:long, ¡d:int) ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡ T:RealType ¡ T:RealType ¡

ImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

OutOfBoundsStrategy ¡ RealRandomAccess ¡

¡

+get(): ¡T ¡ +setPosiJon(posiJon:float[]) ¡ +setPosiJon(posiJon:double[]) ¡ +setPosiJon(pos:int, ¡d:float) ¡ +setPosiJon(pos:long, ¡d:double) ¡

T:RealType ¡ T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

FloatType ¡

¡

+get(): ¡float ¡ +set(value: ¡float) ¡ +copy(): ¡FloatType ¡

slide-14
SLIDE 14

Hands ¡on ¡Programming ¡

① ¡Threshold ¡on ¡an ¡image ¡ ② ¡Center ¡of ¡mass ¡of ¡an ¡image ¡ ③ ¡Gradient ¡of ¡an ¡image ¡ ④ ¡Rigid ¡transforma)on ¡of ¡an ¡image ¡

slide-15
SLIDE 15

Thresholding ¡1 ¡

  • Wrap ¡a ¡float ¡image ¡
  • Compute ¡threshold ¡for ¡

each ¡pixel ¡

  • Overwrite ¡the ¡original ¡

data ¡

  • ImgLib2_Threshold1.java ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

T:RealType ¡

FloatType ¡

¡

+get(): ¡float ¡ +set(value: ¡float) ¡ +copy(): ¡FloatType ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

slide-16
SLIDE 16

Thresholding ¡2 ¡

  • Wrap ¡a ¡float ¡image ¡
  • Create ¡a ¡new ¡Img ¡
  • Compute ¡threshold ¡for ¡

each ¡pixel ¡

  • Write ¡threshold ¡into ¡the ¡

new ¡Img ¡

  • ImgLib2_Threshold2.java ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

T:RealType ¡

FloatType ¡

¡

+get(): ¡float ¡ +set(value: ¡float) ¡ +copy(): ¡FloatType ¡

ImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

slide-17
SLIDE 17

Thresholding ¡3 ¡

  • Wrap ¡any ¡real ¡valued ¡image ¡
  • Create ¡a ¡new ¡Img ¡
  • Compute ¡threshold ¡for ¡each ¡

pixel ¡

  • Write ¡threshold ¡into ¡the ¡new ¡

Img ¡

  • ImgLib2_Threshold3.java ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

T:RealType ¡

ImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

slide-18
SLIDE 18

Thresholding ¡4 ¡

  • Wrap ¡any ¡real ¡valued ¡image ¡
  • Create ¡a ¡new ¡Img ¡
  • Compute ¡threshold ¡for ¡each ¡

pixel ¡for ¡all ¡Comparable ¡

  • Write ¡threshold ¡into ¡the ¡new ¡

Img ¡of ¡BitType ¡(1 ¡bit ¡per ¡pixel) ¡

  • ImgLib2_Threshold4.java ¡

Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡

T:RealType ¡

Type ¡

¡

+set(value: ¡T) ¡ +get(): ¡T ¡ +copy(): ¡T ¡

T:Object ¡

Comparable ¡

¡

+compareTo(value: ¡T): ¡int ¡

T:Object ¡

ImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

slide-19
SLIDE 19

Center ¡of ¡Mass ¡1 ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

  • Wrap ¡any ¡real ¡valued ¡image ¡
  • Use ¡a ¡localizing ¡Cursor ¡to ¡

Compute ¡the ¡center ¡of ¡mass ¡in ¡ two ¡dimensions ¡(x,y) ¡

  • Write ¡the ¡result ¡to ¡the ¡log ¡

window ¡

  • ImgLib2_CenterOfMass1.java ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

slide-20
SLIDE 20

Center ¡of ¡Mass ¡2 ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

  • Wrap ¡any ¡real ¡valued ¡image ¡
  • Use ¡a ¡localizing ¡Cursor ¡to ¡

Compute ¡the ¡center ¡of ¡mass ¡in ¡ n ¡dimensions ¡

  • Write ¡the ¡result ¡to ¡the ¡log ¡

window ¡

  • ImgLib2_CenterOfMass2.java ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡ +numDimensions(): ¡int ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

slide-21
SLIDE 21

Gradient ¡1 ¡

  • Wrap ¡any ¡real ¡valued ¡image ¡
  • Approximate ¡the ¡magnitude ¡of ¡

the ¡gradient ¡for ¡each ¡pixel ¡using ¡a ¡ localizing ¡Cursor ¡on ¡the ¡output ¡ and ¡a ¡RandomAccess ¡on ¡the ¡input ¡

  • ImgLib2_Gradient1.java ¡

ImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

RandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:int[]) ¡ +setPosiJon(posiJon:long[]) ¡ +setPosiJon(pos:int, ¡d:int) ¡ +setPosiJon(pos:long, ¡d:int) ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡ T:RealType ¡

sfx ¡= ¡ I(x+1,y,…) ¡– ¡I(x-­‑1,y,…) ¡

2 ¡

sfy ¡= ¡ I(x,y+1,…) ¡– ¡I(x,y-­‑1,…) ¡

2 ¡ |sf| ¡= ¡ ¡ sfx ¡+ ¡sfy ¡+ ¡… ¡

2 ¡ ¡ 2 ¡ ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡ +numDimensions(): ¡int ¡ +dimension(d:int): ¡long ¡ +min(d:int): ¡long ¡ +max(d:int): ¡long ¡

¡

¡ ImagePlus ¡

T:RealType ¡

slide-22
SLIDE 22

OutOfBoundsStrategies ¡

slide-23
SLIDE 23

Gradient ¡2 ¡

  • Use ¡OutOfBoundsStrategy ¡to ¡

compute ¡gradient ¡for ¡all ¡pixels ¡

  • Approximate ¡the ¡magnitude ¡of ¡

the ¡gradient ¡for ¡each ¡pixel ¡using ¡a ¡ localizing ¡Cursor ¡on ¡the ¡output ¡ and ¡a ¡RandomAccess ¡on ¡the ¡input ¡

  • ImgLib2_Gradient2.java ¡

ImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

RandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:int[]) ¡ +setPosiJon(posiJon:long[]) ¡ +setPosiJon(pos:int, ¡d:int) ¡ +setPosiJon(pos:long, ¡d:int) ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡ T:RealType ¡

sfx ¡= ¡ I(x+1,y,…) ¡– ¡I(x-­‑1,y,…) ¡

2 ¡

sfy ¡= ¡ I(x,y+1,…) ¡– ¡I(x,y-­‑1,…) ¡

2 ¡ |sf| ¡= ¡ ¡ sfx ¡+ ¡sfy ¡+ ¡… ¡

2 ¡ ¡ 2 ¡ ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡ +numDimensions(): ¡int ¡ +dimension(d:int): ¡long ¡ +min(d:int): ¡long ¡ +max(d:int): ¡long ¡

¡

¡ ImagePlus ¡

T:RealType ¡

slide-24
SLIDE 24

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡ +numDimensions(): ¡int ¡ +dimension(d:int): ¡long ¡ +min(d:int): ¡long ¡ +max(d:int): ¡long ¡

¡

¡ ImagePlus ¡

Gradient ¡3 ¡

  • Always ¡return ¡an ¡Img<FloatType> ¡

to ¡prevent ¡overflows ¡ ¡

  • Approximate ¡the ¡magnitude ¡of ¡

the ¡gradient ¡for ¡each ¡pixel ¡using ¡a ¡ localizing ¡Cursor ¡on ¡the ¡output ¡ and ¡a ¡RandomAccess ¡on ¡the ¡input ¡

  • ImgLib2_Gradient3.java ¡

PlanarImgFactory ¡

¡

+create(dim:long[], ¡type:T): ¡Img<T> ¡ +create(dim:int[], ¡type:T): ¡Img<T> ¡ +create(dim:Dimensions, ¡type:T): ¡Img<T> ¡

T:RealType ¡

RandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:int[]) ¡ +setPosiJon(posiJon:long[]) ¡ +setPosiJon(pos:int, ¡d:int) ¡ +setPosiJon(pos:long, ¡d:int) ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡

sfx ¡= ¡ I(x+1,y,…) ¡– ¡I(x-­‑1,y,…) ¡

2 ¡

sfy ¡= ¡ I(x,y+1,…) ¡– ¡I(x,y-­‑1,…) ¡

2 ¡ |sf| ¡= ¡ ¡ sfx ¡+ ¡sfy ¡+ ¡… ¡

2 ¡ ¡ 2 ¡ ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡ T:RealType ¡

slide-25
SLIDE 25

Interpola)on ¡

  • Transform ¡an ¡Img ¡

(RandomAccessible) ¡into ¡a ¡ RealRandomAccessible ¡ that ¡can ¡return ¡values ¡at ¡ any ¡real-­‑valued ¡loca)on ¡in ¡ space ¡

  • First ¡extend ¡by ¡

OutOfBounds ¡

RealRandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:float[]) ¡ +setPosiJon(posiJon:double[]) ¡ +setPosiJon(pos:float, ¡d:int) ¡ +setPosiJon(pos:double, ¡d:int) ¡

T:RealType ¡

slide-26
SLIDE 26

Image ¡Transform ¡

(Localizing)Cursor ¡

¡

+hasNext() ¡ +fwd() ¡ +get(): ¡T ¡ +next(): ¡T ¡ +localize(posiJon:int[]) ¡ +localize(posiJon:long[]) ¡ +getIntPosiJon(d:int): ¡int ¡ +getLongPosiJon(d:int): ¡long ¡

T:RealType ¡

RealType ¡

¡

+getRealFloat(): ¡float ¡ +getRealDouble(): ¡double ¡ +setReal(value: ¡float) ¡ +setReal(value: ¡double) ¡ +copy(): ¡T ¡

T:RealType ¡

  • Wrap ¡any ¡real ¡valued ¡image ¡
  • Use ¡a ¡localizing ¡Cursor ¡on ¡the ¡
  • utput ¡image ¡and ¡a ¡

RealRandomAccess ¡on ¡the ¡input ¡ to ¡transform ¡the ¡image ¡

  • Each ¡pixel ¡loca)on ¡in ¡the ¡output ¡

needs ¡to ¡be ¡transformed ¡and ¡the ¡ respec)ve ¡value ¡read ¡from ¡the ¡ interpolated ¡image ¡

  • ImgLib2_Transform.java ¡

RealRandomAccess ¡

¡

+get(): ¡T ¡ +fwd(d:int) ¡ +bck(d:int) ¡ +setPosiJon(posiJon:float[]) ¡ +setPosiJon(posiJon:double[]) ¡ +setPosiJon(pos:float, ¡d:int) ¡ +setPosiJon(pos:double, ¡d:int) ¡

T:RealType ¡

Img ¡

¡

+cursor(): ¡Cursor<T> ¡ +localizingCursor(): ¡Cursor<T> ¡ +randomAccess(): ¡RandomAccess<T> ¡ +firstElement(): ¡T ¡ +factory(): ¡ImgFactory<T> ¡ +numDimensions(): ¡int ¡

¡

¡ ¡ ¡

¡ ImagePlus ¡

T:RealType ¡

InverCbleBoundable ¡

¡

+applyInverseInPlace(point:float[]) ¡ ¡

slide-27
SLIDE 27

Special ¡thanks ¡to ¡… ¡

  • Tobias ¡Pietzsch ¡(MPI-­‑CBG) ¡
  • Stephan ¡Saalfeld ¡(MPI-­‑CBG) ¡

¡

  • Pavel ¡Tomancak ¡(MPI-­‑CBG) ¡
  • Gene ¡Myers ¡(MPI-­‑CBG) ¡
  • Rob ¡Singer ¡ ¡

(Einstein ¡College ¡& ¡Janelia ¡Farm) ¡

  • ImageJ2 ¡crew ¡

– Johannes ¡Schindelin ¡ – Cur)s ¡Rueden ¡ – Barry ¡DeZonia ¡ – Kevin ¡Eliceiri ¡

  • Albert ¡Cardona ¡
  • KNIME ¡guys ¡

– Chris)an ¡Dietz ¡ – Mar)n ¡Horn ¡

slide-28
SLIDE 28

hpp://fiji.sc/~preibisch/ImgLib2_Introduc)on_src.zip ¡

(the ¡sources ¡for ¡this ¡workshop ¡and ¡completed ¡examples) ¡

hpp://fiji.sc/~preibisch/ImgLib2_Introduc)on.zip ¡

(the ¡sources ¡for ¡this ¡workshop, ¡completed ¡examples ¡and ¡pictures) ¡

hpp://fiji.sc/~preibisch/ImgLib2_presenta)on.pdf ¡

(this ¡presenta)on ¡as ¡PDF) ¡