Last active
December 28, 2020 19:31
-
-
Save mkitti/2f7c5fc3d3f8b0d15dd13f6d67b0e73d to your computer and use it in GitHub Desktop.
Invoking Napari from Julia Language 1.3.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
napari.jl | |
Test using PyCall.jl to invoke Napari ( http://github.com/napari ) from | |
the Julia language ( https://julialang.org/ ) 1.3.1 | |
Mark Kittisopikul | |
January 29th, 2020 | |
""" | |
using PyCall | |
pygui_start(:qt5) | |
# needed to kickstart Qt5 for some reason | |
qapp_obj = pyimport("qtpy.QtWidgets").QApplication([""]) | |
napari = pyimport("napari") | |
skimagedata = pyimport("skimage.data") | |
astronaut = skimagedata.astronaut(); | |
# Modified 2020/09/14 to add name keyword argument | |
# https://github.com/napari/napari/issues/1630 | |
napari.view_image(astronaut, name="astronaut") | |
using Images, TestImages | |
hela = testimage("hela-cells.tif"); | |
hela = imadjustintensity(hela); | |
hela = channelview(hela); | |
hela = PermutedDimsArray(hela,(2,3,1)); | |
#napari cannot handle UInt16 ?? Maybe QT issue | |
#hela = reinterpret(UInt16,hela); | |
napari.view_image(collect(Float32.(hela))) | |
mandrill = testimage("mandrill.tif"); | |
mandrill = channelview(mandrill); | |
mandrill = reinterpret(UInt8,mandrill); | |
mandrill = PermutedDimsArray(mandrill,(2,3,1)); | |
napari.view_image(collect(mandrill)); | |
if !isinteractive() | |
qapp_obj.exec() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are interested in a full blown Julia package, check out the early preview of Napari.jl: https://github.com/mkitti/Napari.jl