![Page 1: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/1.jpg)
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
![Page 2: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/2.jpg)
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
![Page 3: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/3.jpg)
ImgLib2 paper is finally out …
![Page 4: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/4.jpg)
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
![Page 5: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/5.jpg)
ImagePlus
![Page 6: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/6.jpg)
Img
+cursor(): Cursor<T> +localizingCursor(): Cursor<T> +randomAccess(): RandomAccess<T> +firstElement(): T +factory(): ImgFactory<T>
ImagePlus
![Page 7: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/7.jpg)
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
![Page 8: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/8.jpg)
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
![Page 9: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/9.jpg)
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
![Page 10: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/10.jpg)
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
![Page 11: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/11.jpg)
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
![Page 12: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/12.jpg)
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
![Page 13: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/13.jpg)
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
![Page 14: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/14.jpg)
Hands on Programming
① Threshold on an image ② Center of mass of an image ③ Gradient of an image ④ Rigid transforma)on of an image
![Page 15: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/15.jpg)
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
![Page 16: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/16.jpg)
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
![Page 17: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/17.jpg)
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
![Page 18: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/18.jpg)
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
![Page 19: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/19.jpg)
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
![Page 20: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/20.jpg)
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
![Page 21: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/21.jpg)
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
sfx = I(x+1,y,…) – I(x-‐1,y,…)
2
sfy = I(x,y+1,…) – I(x,y-‐1,…)
2
|sf| = sfx + sfy + … 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
![Page 22: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/22.jpg)
OutOfBoundsStrategies
![Page 23: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/23.jpg)
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
sfx = I(x+1,y,…) – I(x-‐1,y,…)
2
sfy = I(x,y+1,…) – I(x,y-‐1,…)
2
|sf| = sfx + sfy + … 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
![Page 24: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/24.jpg)
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
sfx = I(x+1,y,…) – I(x-‐1,y,…)
2
sfy = I(x,y+1,…) – I(x,y-‐1,…)
2
|sf| = sfx + sfy + … 2 2 T:RealType
RealType
+getRealFloat(): float +getRealDouble(): double +setReal(value: float) +setReal(value: double) +copy(): T
T:RealType
T:RealType
![Page 25: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/25.jpg)
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
![Page 26: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/26.jpg)
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
output 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[])
![Page 27: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/27.jpg)
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
![Page 28: Introduction to ImgLib2 presentation.pdf · 2020. 8. 18. · Introduc)on*to*ImgLib2* StephanPreibisch,TobiasPietzsch,StephanSaalfeld * AlbertEinstein*College*of*Medicine,*New*York*](https://reader036.vdocument.in/reader036/viewer/2022071012/5fcaa2f470a1b8737733541a/html5/thumbnails/28.jpg)
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)