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 not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,14 @@ CTX = ctx # ctx is the network's context, not RunPythonScript's"

graph = ctx.field("DtfSkeletonization.outBase1").object()
if graph is not None:
label = "Label"
print('Num edges', len(graph.getEdges()))
for edge in graph.getEdges():
end_node = edge.getEndNode()
for skeleton in edge.getSkeletons():
if label not in skeleton.properties:
skeleton.createPropertyDouble(label, skeleton.getProperty("MinDistance"))
skeleton.setProperty(label, skeleton.getProperty("MinDistance"))
label = "Label"
print('Num edges', len(graph.getEdges()))
for edge in graph.getEdges():
end_node = edge.getEndNode()
for skeleton in edge.getSkeletons():
if label not in skeleton.properties:
skeleton.createPropertyDouble(label, skeleton.getProperty("MinDistance"))
skeleton.setProperty(label, skeleton.getProperty("MinDistance"))

ctx.field("GraphToVolume.update").touch()
ctx.field("SoVascularSystem.apply").touch()*"
Expand Down
6 changes: 3 additions & 3 deletions mevislab.github.io/content/tutorials/summary/summary3.md
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ Interface {
max = 1000
}
Field selected3DView {
type = Enum
type = Enum
items {
item Segmented {}
item File {}
Expand All @@ -606,7 +606,7 @@ Interface {
title = Reset
}
Field markerPosition {
type = Vector3
type = Vector3
}
Field applyMarker {
type = Trigger
Expand Down Expand Up @@ -687,7 +687,7 @@ Window {
}
}
Box Info {
layout = Horizontal
layout = Horizontal
Field totalVolume {}
}
}
Expand Down
28 changes: 14 additions & 14 deletions mevislab.github.io/content/tutorials/testing/testingexample1.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,24 @@ from mevis import *
from TestSupport import Base, Fields, Logging
from TestSupport.Macros import *

filePath="C:/Program Files/<MeVisLab version>/Packages/MeVisLab/Resources/DemoData/BrainT1Dicom"
filePath = "C:/Program Files/<MeVisLab version>/Packages/MeVisLab/Resources/DemoData/BrainT1Dicom"

def OpenFiles():
ctx.field("DicomImport.inputMode").value = "Directory"
ctx.field("DicomImport.source").value = filePath
ctx.field("DicomImport.triggerImport").touch()
MLAB.processEvents()
while not ctx.field("DicomImport.ready").value:
MLAB.sleep(1)
Base.ignoreWarningAndError(MLAB.processEvents)
ctx.field("DicomImport.selectNextItem").touch()
MLAB.log("Files imported from: " + ctx.field("DicomImport.source").value)
ctx.field("DicomImport.inputMode").value = "Directory"
ctx.field("DicomImport.source").value = filePath
ctx.field("DicomImport.triggerImport").touch()
MLAB.processEvents()
while not ctx.field("DicomImport.ready").value:
MLAB.sleep(1)
Base.ignoreWarningAndError(MLAB.processEvents)
ctx.field("DicomImport.selectNextItem").touch()
MLAB.log("Files imported from: " + ctx.field("DicomImport.source").value)

def TEST_DicomImport():
expectedValue = 1.0
OpenFiles()
currentValue = ctx.field("DicomImport.progress").value
ASSERT_FLOAT_EQ(expectedValue, currentValue)
expectedValue = 1.0
OpenFiles()
currentValue = ctx.field("DicomImport.progress").value
ASSERT_FLOAT_EQ(expectedValue, currentValue)
```
{{</highlight>}}

Expand Down
24 changes: 12 additions & 12 deletions mevislab.github.io/content/tutorials/testing/testingexample3.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ Add the Python function to your *.script* file:
{{< highlight filename="IterativeTestCase.py" >}}
```Python
def ITERATIVETEST_TestWindowCenter():
return testData, testPatient
return testData, testPatient
```
{{</highlight>}}

This function defines that <inlineCode>testPatient</inlineCode> shall be called for each entry available in the defined list <inlineCode>testData</inlineCode>. Define the function <inlineCode>testPatient</inlineCode>:
{{< highlight filename="IterativeTestCase.py" >}}
```Python
def testPatient(path, windowCenter):
ctx.field("LocalImage.name").value = patientPathPrefix + path
tree = ctx.field("LocalImage.outImage").getDicomTree()
importValue = str(tree.getTag("WindowCenter").value())
dicomValue = str(ctx.field("DicomTagViewer.tagValue0").value)
ASSERT_EQ(windowCenter, importValue, "Checking expected WindowCenter value against DICOM tree value.")
ASSERT_EQ(windowCenter, dicomValue, "Checking expected WindowCenter value against DicomTagViewer value.")
ctx.field("LocalImage.name").value = patientPathPrefix + path
tree = ctx.field("LocalImage.outImage").getDicomTree()
importValue = str(tree.getTag("WindowCenter").value())
dicomValue = str(ctx.field("DicomTagViewer.tagValue0").value)
ASSERT_EQ(windowCenter, importValue, "Checking expected WindowCenter value against DICOM tree value.")
ASSERT_EQ(windowCenter, dicomValue, "Checking expected WindowCenter value against DicomTagViewer value.")
```
{{</highlight>}}

Expand Down Expand Up @@ -104,11 +104,11 @@ Now, extend your network by adding a `View2D` module and connect it with the `Lo
{{< highlight filename="IterativeTestCase.py" >}}
```Python
def testPatient(path, windowCenter):
...
Fields.setValue("View2D.startSlice", 0)
result = ScreenShot.createOffscreenScreenShot("View2D.self", "screentest.png")
Logging.showImage("My screenshot", result)
Logging.showFile("Link to screenshot file", result)
...
Fields.setValue("View2D.startSlice", 0)
result = ScreenShot.createOffscreenScreenShot("View2D.self", "screentest.png")
Logging.showImage("My screenshot", result)
Logging.showFile("Link to screenshot file", result)
```
{{</highlight>}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,13 @@ Let's implement the <inlineCode>_getImage</inlineCode> function first:
```Python
...
def _getImage():
if ctx.field("SwapFlipDimensions.output0").isValid():
# Get image after all modifications have been done
image = ctx.field("SwapFlipDimensions.output0").image()
if ctx.field("SwapFlipDimensions.output0").isValid():
# Get image after all modifications have been done
image = ctx.field("SwapFlipDimensions.output0").image()

return image
else:
return None
return image
else:
return None
...
```
{{</highlight>}}
Expand Down Expand Up @@ -447,7 +447,7 @@ Open the *.script* file and add a *Window* section. In this window, we reuse the
...
Window {
height = 100
width = 100
width = 100
Category {
Viewer ROISelect.scene.self {
type = SoRenderArea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,28 @@ After loading the file, go to the previously implemented *grabImage* function an
{{< highlight filename="<YOUR_MODULE_NAME>.py" >}}
```Python
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)
```
{{</highlight>}}

In the end, destroy all OpenCV windows in *releaseCamera* function.
{{< highlight filename="<YOUR_MODULE_NAME>.py" >}}
```Python
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()
```
{{</highlight>}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ ctx.field("DtfSkeletonization.update").touch()

graph = ctx.field("DtfSkeletonization.outBase1").object()
if graph is not None:
for edge in graph.getEdges():
print(edge.getId())
for edge in graph.getEdges():
print(edge.getId())

ctx.field("GraphToVolume.update").touch()
```
Expand Down Expand Up @@ -108,12 +108,12 @@ ctx.field("DtfSkeletonization.update").touch()

graph = ctx.field("DtfSkeletonization.outBase1").object()
if graph is not None:
label = "Label"
for edge in graph.getEdges():
for skeleton in edge.getSkeletons():
if label not in skeleton.properties:
skeleton.createPropertyDouble(label, edge.getId())
skeleton.setProperty(label, edge.getId())
label = "Label"
for edge in graph.getEdges():
for skeleton in edge.getSkeletons():
if label not in skeleton.properties:
skeleton.createPropertyDouble(label, edge.getId())
skeleton.setProperty(label, edge.getId())

ctx.field("GraphToVolume.update").touch()
```
Expand Down Expand Up @@ -182,14 +182,14 @@ ctx.field("DtfSkeletonization.update").touch()

graph = ctx.field("DtfSkeletonization.outBase1").object()
if graph is not None:
label = "Label"
print('Num edges', len(graph.getEdges()))
for edge in graph.getEdges():
end_node = edge.getEndNode()
for skeleton in edge.getSkeletons():
if label not in skeleton.properties:
skeleton.createPropertyDouble(label, skeleton.getProperty("MinDistance"))
skeleton.setProperty(label, skeleton.getProperty("MinDistance"))
label = "Label"
print('Num edges', len(graph.getEdges()))
for edge in graph.getEdges():
end_node = edge.getEndNode()
for skeleton in edge.getSkeletons():
if label not in skeleton.properties:
skeleton.createPropertyDouble(label, skeleton.getProperty("MinDistance"))
skeleton.setProperty(label, skeleton.getProperty("MinDistance"))

ctx.field("GraphToVolume.update").touch()
ctx.field("SoVascularSystem.apply").touch()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading