object-oriented application development with mevislab and python
DESCRIPTION
Object-oriented application development with MeVisLab and Python. Frank Heckel Michael Schwier Heinz-Otto Peitgen. What I am going to talk about. Development of (medical) software assistants Issues in multilevel development approaches (MeVisLab) Object-oriented programming. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/1.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 1
Object-oriented application development with MeVisLab and Python
Frank HeckelMichael Schwier
Heinz-Otto Peitgen
![Page 2: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/2.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 2
What I am going to talk about
› Development of (medical) software assistants› Issues in multilevel development approaches (MeVisLab)› Object-oriented programming
![Page 3: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/3.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 3
Rapid Application Prototyping with MeVisLab
› Visual development environment for medical image processing and visualization
![Page 4: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/4.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 4
Script
Multilevel Development Approach
› Application Level» GUI design» Application logic
› Network Level» Image processing and visualization processes» Based on library of modules
› Module » Low-level algorithm implementationC++
Visual
![Page 5: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/5.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 5
Module/C++ Level Network Level Script Level
C++ Module
Int Float String
Image
![Page 6: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/6.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 6
The typical script level problem
› They form a global layer upon the network» Practically no access limitations» No scope bound to a subnetwork or modules
› Initial intention was to use it for short code snippets» Convenience (no need to get back to C++/recompile/restart)» Short conditional logic
› Since it’s so easy …» Developers put more and more logic and processing into the script
› Applications naturally need a lot of code upon the network» Controlling the data flow» Interaction» …
› Programmers tend to take Script programming not so serious
![Page 7: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/7.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 7
Giving a programmer this much freedom …
![Page 8: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/8.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 8
Let‘s build an application
› Load a BL and/or FU dataset that have been specified in the GUI › Switch to a proper GUI configuration if successful
![Page 9: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/9.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 9
Example
GUI
DataProcessing
LoadData
User Interface
Data Processing
Specific ModulesbaselineFilename
followupFilename
loadButton
LoadData_filename filename
LoadData_valid valid
Import
![Page 10: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/10.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 10
Call-Chain
GUI DataProcessing LoadData
baselineFilename
followupFilename
loadButton
LoadData_filename filename
LoadData_valid valid
def loadButtonPressed(field): if ctx.field(“baselineFilename”).value != “” ... state = “BL_AND_FU” ...
def baseline_LoadDataDone(field):if state == “BL_AND_FU”: if not successful: ...
def filenameChanged(field):
# loading stuff ...
if loadSuccessful: ctx.field(“valid”).value = True else: ctx.field(“valid”).value = False
Event
Set
Connection
EventSet
Event
GlobalState
Connection
IMPLICIT
![Page 11: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/11.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 11
Networks can get complex and confusing
Can you imagine the network script?
![Page 12: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/12.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 12
Join Script and Module
Module
Module
![Page 13: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/13.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 13
Concept
DataProcessingcontext: Networkparent: ReferenceloadData: Reference…init (ctx: Network, child: Reference): voidsetParent (parent: Reference): voidgetField (field: String): String/Int/Float
loadFile (filename: String): Boolean
DataProcessing
GUI
context: Networkparent: ReferencedataProcessing: Reference…
init (ctx: Network, child: Reference): voidsetParent (parent: Reference): voidgetField (field: String): String/Int/Float
loadFile (filename: String): Boolean
LoadData
context: Networkparent: Reference…
init (ctx: Network, child: Reference): voidsetParent (parent: Reference): voidgetField (field: String): String/Int/Float
loadFile (filename: String): Boolean
GUI LoadData
![Page 14: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/14.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 14
Integration in MeVisLab
DataProcessingInit
## global reference to this modules instancethis = None
## access method to the global this objectdef getThis(): global this return this
## the init method creates the global object## (one class instance per module instance)def init(ctx): global this loadData = ctx.module(“LoadData”).call(“getThis”)
this = DataProcessing(ctx, loadData)
return
DataProcessing
context: Networkparent: ReferenceloadData: Reference…
init (ctx: Network, child: Reference): voidsetParent (parent: Reference): voidgetField (field: String): String/Int/Float
loadFile (filename: String): Boolean
![Page 15: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/15.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 15
Integration in MeVisLab
DataProcessingInit
## global reference to this modules instancethis = None
## access method to the global this objectdef getThis(): global this return this
## the init method creates the global object## (one class instance per module instance)def init(ctx): global this loadData = ctx.module(“LoadData”).call(“getThis”)
this = DataProcessing(ctx, loadData)
return
DataProcessing
context: Networkparent: ReferenceloadData: Reference…
init (ctx: Network, child: Reference): voidsetParent (parent: Reference): voidgetField (field: String): String/Int/Float
loadFile (filename: String): Boolean
## global reference to this modules instancethis = None
## access method to the global this objectdef getThis(): global this return this
## the init method creates the global object## (one class instance per module instance)def init(ctx): global this loadData= ctx.module(“LoadData”).call(“getThis”)
this = DataProcessing(ctx, loadData)
return
![Page 16: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/16.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 16
Call chain
GUI DataProcessing LoadData
baselineFilename
followupFilename
loadButton
def loadData(self): if self.getfield("baselineFilename").value != "" and self.getfield("follo... if self.baselineScan.loadFile( self.getfield("baselineFilename").value ): if self.followupScan.loadFile( self.getfield("followupFilename").value ): # switch to bl+fu layout... else: ...
def loadFile(self, filename): return loadData.loadFile(filename)
EXPLICIT
def loadFile(self, filename): # loading stuff ... return loadSuccessful
Event
Call Call
![Page 17: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/17.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 17
The Essence
Use object oriented programming (wisely) …
… even if it‘s tempting not to do it!
![Page 18: Object-oriented application development with MeVisLab and Python](https://reader035.vdocuments.site/reader035/viewer/2022062302/568163f4550346895dd57dce/html5/thumbnails/18.jpg)
Fraunhofer MEVIS Institute for Medical Image Computing 01.10.2009 INFORMATIK 2009 – Softwareassistenten in der Medizin 18
The Essence
Use object oriented programming (wisely) …
… even if it‘s tempting not to do it!
The users/clinicians will profit.