plugins - medical image processing, analysis and visualization

70
Plugins 1 http://mipav.cit.nih.gov

Upload: others

Post on 03-Feb-2022

8 views

Category:

Documents


0 download

TRANSCRIPT

Plugins

1

http://mipav.cit.nih.gov

MIPAV Team

2

Matthew McAuliffe

William Gandler

Ruida Cheng

Evan McCreedy

Justin Senseney

Contractors

Nish Pandya, SSAI

Alexandra Bokinsky, Geometric Tools Inc.

Medical Image Processing, Analysis & Visualization

&Plugins

3

Justin Senseney

[email protected]

Biomedical Imaging Research Services Section (BIRSS)

Imaging Sciences LaboratoryDivision of Computational Bioscience

Center for Information Technology (301) 594-5887

http://mipav.cit.nih.gov

Mipav Interface

4

•Options exist•How to manipulate

5

Plugins • PlugInAlgorithm – Develop new functionality and ability

to call functions already in MIPAV.

• PlugInFile – Develop files readers to support unique file formats.

• PlugInGeneric – Plugins that do not require an open image.

• PlugInView – Develop new visualizations of datasets.

• PlugIn – ImageJ plugin.

6

Plugins • To build a plugin, three files are typically used:

– PlugInTest.class • Interface between MIPAV and plugin.

– PlugInDialogTest.class• Creates dialog for input.

– PlugInAlgorithmTest.class• The actual algorithm.

7

Plugins - Location

• Stored for each user:

– Windows - C:\Users\{{user_name}}\mipav\plugins

– Linux/Mac OS - /home/{{user_name}}/mipav/plugins

8

Plugins - Installing

9

Plugins – Installing• Installing a plugin (Plugins -> Install Plugin)

10

Copies files:• .class• .jar• .zip

into user directory.

HINT:If something goes wrong, just copy the files yourself using locations on Slide 8.

Plugins – Installing (2)

11

Plugins - Executing

12

Plugins - Scripting

13

Execute plugin

Script Running Review

14

Uninstall Plugin

15

Plugin Lab

• Install• PlugInCT_MD – already in MIPAV• MuscleSegmentation –

http://dcb.cit.nih.gov/~senseneyj/code/muscleSeg.html

• Bio-Formats - http://dcb.cit.nih.gov/~senseneyj/code/bioformats.html

• ImageJ – http://dcb.cit.nih.gov/~senseneyj/code/imagej.html

16

Plugins from command line

17

• Mipav –p Plugin_Name

• Can be run headless

Break - Review

18

• Plugins• File• Generic• Algorithm• View

• Stored in user folder• Install, Run, Uninstall

Development environment

19

• Textpad: http://www.textpad.com/• Simple, few linked files• Want to learn Java

• Eclipse: http://www.eclipse.org/• Many files, libraries• Source repository• Want to use Java

Download Eclipse

20

• Download here:http://www.eclipse.org/downloads/

“Install” Eclipse

21

Fix Eclipse

22

Specify Memory

Start Eclipse

23

Java Programs

24

• Virtual machine = platform independent• JRE to execute

JRE Setting

25

Add JRE

26

Locate JRE

27

Locate JRE

28

Eclipse project

29

• Mipav• Java project• Contains plugins

Make Mipav Project

30

Make Mipav Project

31

Specify JRESpecify JRE

Mipav Program

32

• Execution environment needs to be replicated

Execution environment

33

• Classpath• Libraries - jars• Associated class files

• Memory – used by VM• Launching class file

Jars

34

• Libraries• PDFbox• JPEG2000• ImageJ

• Help files• Insight Toolkit wrappers

Add Jars

35

More Jars

36

More Jars: Help

37

More Jars: ITK

38

Class files

39

• Object-oriented• Executable programs• In Mipav:

• Read/write images• Apply filters• Run plugins!

External class folder

40

Select the correct version of Mipav

Click Finish!

41

Note class folder and JRE selection

MipavMain

42

Run Configuration

43

New Configuration

44

Select Main Type

45

Java Memory

46

-Xms (min), -Xmx (max)

Memory

47

Run Mipav

48

• MipavMain is executed• Classpath is set• Memory allocated• Libraries are referenced

Mipav Launched

49

Version number

VM Memory

View JVM Info

50

JVM Info

51

JRE in mipav

Plugin folder in workspace

Java Compiler

52

• Source code: • *.java files• Text-editor readable

• Platform independent byte-code: • *.class files

Get NewGeneric2

53

• Download three files from http://dcb.cit.nih.gov/~senseneyj/code/plugin.html

• PlugInNewGeneric2.java• PlugInDialogNewGeneric2.java• PlugInAlgorithmNewGeneric2.java

Import NewGeneric2

54

• In Eclipse: Press File->Import

Compile NewGeneric2

55

• This is done for you, incrementally in Eclipse• Errors and warnings update with each change

Install NewGeneric2

56

• Only install PlugInNewGeneric2.class

Why did this work?

Run NewGeneric2

57

• Open an image, try it out

Look at NewGeneric2

58

• Open Dialog, try to change the title “Generic Plugin”

Change NewGeneric2

59

• Location:

Run NewGeneric2

60

• See change:

NewGeneric Algorithm

61

• Look at algorithm construction, extecution

MIPAV Documentation

62

• CTRL-click on run algorithm, now try hovering:

Plugins - MIPAV API

63

Download from: http://mipav.cit.nih.gov/documentation/api.zip

Plugins - MIPAV API

64

Attach here:

Plugins - MIPAV API

65

View here:

Modify Plugin Lab

66

• Edit PlugInNewGeneric2:• Change text in plugin dialog.

• Print out when algorithm has completed.

• Increase kernel size.

• Change 3D to 2.5D processing.

• Add check box to allow user to select either 3D or 2.5D processing.

10pt

10pt

10pt

20pt

80pt

Plugins - Documentation

67

• Plugin development documentationhttp://mipav.cit.nih.gov/documentation/userguide/volume1/MIPAV_PlugIns.pdf

•This presentation is posted at:•http://dcb.cit.nih.gov/~senseneyj/code/plugin.html

• Will also be posted here:•http://mipav.cit.nih.gov/documentation/presentations/

•Also see this wiki page:•http://mipav.cit.nih.gov/pubwiki/index.php/Writing_MIPAV_plugins_without_MIPAV_source_code#Requirements

Summary

• Plugins– Unique functionality using MIPAV API

• Develop in Eclipse• Use MIPAV API

68

69

Visualization

File readerQuantification File writerProcessing Macros