Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified mevislab.github.io/content/examples/basic_mechanisms/Modules.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified mevislab.github.io/content/examples/summary/TutorialSummary.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified mevislab.github.io/content/examples/summary/TutorialSummary_UI.zip
Binary file not shown.
Binary file modified mevislab.github.io/content/examples/testing/Example1/TestCases.zip
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,53 @@

_interfaces = []
camera = None
face_cascade = cv2.CascadeClassifier('C:/tmp/haarcascade_frontalface_default.xml')
face_cascade = cv2.CascadeClassifier("C:/tmp/haarcascade_frontalface_default.xml")


# Setup the interface for PythonImage module
def setupInterface():
global _interfaces
_interfaces = []
interface = ctx.module("PythonImage").call("getInterface")
_interfaces.append(interface)
global _interfaces
_interfaces = []
interface = ctx.module("PythonImage").call("getInterface")
_interfaces.append(interface)


# Grab image from camera and update
def grabImage():
_, img = camera.read()
updateImage(img)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
# Display the output
cv2.imshow('img', img)
_, img = camera.read()
updateImage(img)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
for x, y, w, h in faces:
cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
# Display the output
cv2.imshow("img", img)


# Update image in interface
def updateImage(image):
_interfaces[0].setImage(OpenCVUtils.convertImageToML(image), minMaxValues = [0,255])
_interfaces[0].setImage(OpenCVUtils.convertImageToML(image), minMaxValues=[0, 255])


# Start capturing WebCam
def startCapture():
global camera
if not camera:
camera = cv2.VideoCapture(0)
ctx.callWithInterval(0.1, grabImage)
global camera
if not camera:
camera = cv2.VideoCapture(0)
ctx.callWithInterval(0.1, grabImage)


# Stop capturing WebCam
def stopCapture():
ctx.removeTimers()
ctx.removeTimers()


# Release camera in the end
def releaseCamera(_):
global camera, _interfaces
ctx.removeTimers()
_interfaces = []
if camera:
camera.release()
camera = None
cv2.destroyAllWindows()
global camera, _interfaces
ctx.removeTimers()
_interfaces = []
if camera:
camera.release()
camera = None
cv2.destroyAllWindows()
Binary file modified mevislab.github.io/content/examples/thirdparty/monai/MONAIDemo.zip
Binary file not shown.
Binary file not shown.
Binary file modified mevislab.github.io/content/examples/thirdparty/pytorch2/DemoAI.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,14 @@ Interface {
internalName = Arithmetic2.output0
}
}
Parameters {

}
Parameters {}
}

Window MyWindowName {
title = MyWindowTitle

Box MyBox {
Category {
title = MyWindowTitle

Box MyBox {}
}
}
```
Expand All @@ -117,7 +115,7 @@ Window MyWindowName {
![Module Panel](images/tutorials/basicmechanics/ModulePanel.png "Module Panel")

You can define different properties of your control. For a window, you can, for example, define a title, or whether the
window should be shown in full screen (*fullscreen = True*).
window should be shown in full screen (*fullscreen = Yes*).

These properties are called {{< docuLinks "/Resources/Documentation/Publish/SDK/MDLReference/#SyntaxTagsAndValues" "tags" >}} and are individually different for each control. Which tags exist for the control window can be found
{{< docuLinks "/Resources/Documentation/Publish/SDK/MDLReference/index.html#mdl_Window" "here" >}}.
Expand All @@ -136,13 +134,14 @@ Window MyWindowName {
title = MyWindowTitle
w = 100
h = 50

Vertical {
Box MyBox {
title = "Title of my Box"
}
Label MyLabel {
Category {
Vertical {
Box MyBox {
title = "Title of my Box"
}
Label MyLabel {
title = "This is a label below the box"
}
}
}
}
Expand All @@ -157,13 +156,14 @@ Window MyWindowName {
title = MyWindowTitle
w = 100
h = 50

Horizontal {
Box MyBox {
title = "Title of my Box"
}
Label MyLabel {
title = "This is a label beside the box"
Category {
Horizontal {
Box MyBox {
title = "Title of my Box"
}
Label MyLabel {
title = "This is a label beside the box"
}
}
}
}
Expand Down Expand Up @@ -209,8 +209,10 @@ Changes of the properties of this field can be done in the curled brackets using
Window MyWindowName {
title = MyWindowTitle

Field Convolution.predefKernel {
title = Kernel
Category {
Field Convolution.predefKernel {
title = Kernel
}
}
}
```
Expand Down Expand Up @@ -243,7 +245,9 @@ Interface {

Window MyWindowName {
title = MyWindowTitle
Field kernel {}
Category {
Field kernel {}
}
}
```
{{</highlight>}}
Expand All @@ -259,8 +263,10 @@ Window MyWindowName {
title = MyWindowTitle
wakeupCommand = myWindowCommand

Button MyButton {
command = myButtonAction
Category {
Button MyButton {
command = myButtonAction
}
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ We first define the input for the image.
{{< highlight filename="MyItemModelView.script" >}}
```Stan
Interface {
Inputs {
Field inImage { type = Image }
}
Outputs {}
Parameters {}
Inputs {
Field inImage { type = Image }
}
Outputs {}
Parameters {}
}
```
{{</highlight>}}
Expand All @@ -78,21 +78,21 @@ All of them have to be defined as a *Field* in the *Parameters* section of the s
{{< highlight filename="MyItemModelView.script" >}}
```Stan
Interface {
Inputs {
Field inImage { type = Image }
}
Outputs {}
Parameters {
Field id { type = Int }
Field patientName { type = String }
Field patientBirthdate { type = String }
Field studyDescription { type = String }
Field studyDate { type = String }
Field modality { type = String }
Field seriesDescription { type = String }
Field seriesDate { type = String }
Field sopInstanceUID { type = String }
}
Inputs {
Field inImage { type = Image }
}
Outputs {}
Parameters {
Field id { type = Int }
Field patientName { type = String }
Field patientBirthdate { type = String }
Field studyDescription { type = String }
Field studyDate { type = String }
Field modality { type = String }
Field seriesDescription { type = String }
Field seriesDate { type = String }
Field sopInstanceUID { type = String }
}
}
```
{{</highlight>}}
Expand All @@ -107,23 +107,23 @@ We can now add the *ItemModelView* to our panel and define the columns of the vi
{{< highlight filename="MyItemModelView.script" >}}
```Stan
Window {
Category {
Vertical {
ItemModelView myItemModel {
name = itemModelView
idAttribute = id
Column id {}
Column patientName {}
Column patientBirthdate {}
Column studyDescription {}
Column studyDate {}
Column modality {}
Column seriesDescription {}
Column seriesDate {}
Column sopInstanceUID {}
}
Category {
Vertical {
ItemModelView myItemModel {
name = itemModelView
idAttribute = id
Column id {}
Column patientName {}
Column patientBirthdate {}
Column studyDescription {}
Column studyDate {}
Column modality {}
Column seriesDescription {}
Column seriesDate {}
Column sopInstanceUID {}
}
}
}
}
}
```
{{</highlight>}}
Expand All @@ -150,11 +150,11 @@ We want to get the necessary information from the defined input image *inImage*.
{{< highlight filename="MyItemModelView.script" >}}
```Stan
Commands {
source = $(LOCAL)/MyItemModelView.py
source = $(LOCAL)/MyItemModelView.py

FieldListener inImage {
command = imageChanged
}
FieldListener inImage {
command = imageChanged
}
}
```
{{</highlight>}}
Expand Down Expand Up @@ -259,23 +259,24 @@ You can see that the above Python code uses a field *selection* that contains th
{{< highlight filename="MyItemModelView.script" >}}
```Stan
Interface {
...
Parameters {
...
Field selection { type = String }
...
}
Parameters {
...
Field selection { type = String }
...
}
}

Window {
Category {
Vertical {
ItemModelView myItemModel {
...
selectionField = selection
...
}
Category {
Vertical {
ItemModelView myItemModel {
...
selectionField = selection
...
}
}
}
}
}
```
{{</highlight>}}
Expand Down Expand Up @@ -368,11 +369,11 @@ We can now add options to interact with the *ItemModelView*. Open the *.script*
{{< highlight filename="MyItemModelView.script" >}}
```Stan
Commands {
...
FieldListener selection {
command = itemClicked
}
...
...
FieldListener selection {
command = itemClicked
}
...
}
```
{{</highlight>}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Open the *.script* file and add a *Commands* section defining the name of the Py
{{< highlight filename="IsoCSOs.script" >}}
```Stan
Commands {
source = $(LOCAL)/mytest.py
source = $(LOCAL)/mytest.py
}
```
{{</highlight>}}
Expand Down
Loading
Loading