-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample_artistlib.py
More file actions
29 lines (25 loc) · 1.02 KB
/
example_artistlib.py
File metadata and controls
29 lines (25 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import artistlib as a
# connect to aRTist (default: host='localhost', port=3658)
jct = a.Junction()
# print aRTist's version number
ver = jct.send('::aRTist::GetVersion full')
print(ver)
# - load a project
# - run the simulation
# - save the resulting projection from the image viewer
jct.send('FileIO::OpenAny $Xray(LibraryDir)/ExampleProjects/Schlumpfmark.aRTist')
jct.send('Engine::GoCmd')
ans = "Saved as: "
ans += jct.send('Modules::Invoke ImageViewer SaveFile [file join $env(HOME) Pictures/artistlib.tif] true')
print(ans)
# - load a project
# - run the simulation without viewing the result
# - transfer the final projection
# - saving the projection image >>>> This requires aRTist 2.12.7 or higher! <<<<
# - delete the images to release the memory
jct.send('FileIO::OpenAny $Xray(LibraryDir)/ExampleProjects/aRTist.aRTist')
jct.send('set imgList [Engine::Go]')
jct.send('RemoteControl::SendImage [lindex $imgList 0]')
jct.save_image("transferred.tif")
jct.send('foreach i $imgList {$i Delete}')
print("Saved as: transferred.tif")