You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Id like to know if it is possible to run chromagnon from python just as a module without GUI and all the overhead of bioformats.
I love the application and I would like to implement it into my analysis scripts. That is, import it as a module, run it on a number of numpy arrays using another set of reference arrays or even better a configuration file/object.
Is this possible?
The text was updated successfully, but these errors were encountered:
Thank you for using Chromagnon.
Yes, of course, you can run Chromagnon from python, although a numpy array needs to be saved in a file, preferably with appropriate header information.
Assuming you have installed the source code, then you can simply do:
import Chromagnon as ch
ch.aligner.Chromagnon.__init__.__doc__
Alternatively, please take a look at the documentation for class Chromagnon in Chromagnon.aligner.py (line 52 in v0.89).
You will find how to run it interactively.
You can also omit installing JDK, javabridge, and python-bioformats, lxml, then it will not use bioformats.
You will see warning concerning biofomats not installed, but don't worry.
You can disable this warning by changing line 89 (as of v0.89) of Chromagnon.imgio.bioformatsIO.py as follows:
To save numpy arrays in files, you can use any other packages or the imgio package of Chromagnon like this:
import numpy as np
from Chromagnon import imgio
outfn = 'test.tif' # the extension should be 'tif' or 'dv'
a = np.empty((2,10,256,256), np.uint16) # assuming the axes of (w,z,y,x)
with imgio.Writer(outfn) as h:
h.setDim(nx=256, ny=256, nz=10, nt=1, nw=2, dtype=np.uint16, wave=[515,600])
h.setPixelSize(pz=0.25, py=0.08, px=0.08) # in micron
for w in range(h.nw):
h.write3DArr(a[w], t=0, w=w)
Hi,
Id like to know if it is possible to run chromagnon from python just as a module without GUI and all the overhead of bioformats.
I love the application and I would like to implement it into my analysis scripts. That is, import it as a module, run it on a number of numpy arrays using another set of reference arrays or even better a configuration file/object.
Is this possible?
The text was updated successfully, but these errors were encountered: