Closed jstitlow closed 3 years ago
Hi,
I guess javabridge
from conda
does not work with python-bioformats
.
I used the pip
version of javabridge
and python-bioformats
.
JDK
was separately installed.
If I remember correctly, the freeglut
library may also be required to be installed manually on some platforms.
(e.g. installed by the system's package manager)
I have not tested the combination of Ubuntu14 and python2.7, though.
Let me know if you get any more issues.
Atsushi
Thank you Atsushi,
Removing the conda installations and installing the pip version of javabridge
and python-bioformats
solved the version conflict issue.
Now it is not importing generalIO from imgio:
~$ chromagnon -h
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/pyfftw/__init__.py:16: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
from .pyfftw import (
FFTW: True
SCIK: False
REIK: False
* couldn't load module(s): P
Traceback (most recent call last):
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/bin/chromagnon", line 7, in <module>
from Chromagnon import main
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/__init__.py", line 14, in <module>
import version, cutoutAlign, alignfuncs, chromformat, aligner, chromeditor, threads, flatfielder, chromagnon
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/chromformat.py", line 11, in <module>
import imgio
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/imgio/__init__.py", line 15, in <module>
from imgio import generalIO, mrcIO, imgSeqIO, multitifIO, bioformatsIO
ImportError: cannot import name generalIO
Have you seen this before?
Also got missing module error after re-cloning and re-installing from setup.py (or using pip). But I think this is because it is trying to import chromagnon but the site packages are Chromagnon. Changing chromagnon to Chromagnon in the bin file fixed the problem.
~$ chromagnon
Traceback (most recent call last):
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/bin/chromagnon", line 7, in <module>
from chromagnon import main
ImportError: No module named chromagnon
I am able to run the code by calling python on the chromagnon.py file, but it does not generate an aligned target image, only .csv file and log (output below).
$ python ~/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/chromagnon.py --reference 20180730_Edu_3channel_align-AiryscanProcessing.tif 20180730_Edu_3channel_align-AiryscanProcessing.tif
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/pyfftw/__init__.py:16: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
from .pyfftw import (
FFTW: True
SCIK: False
REIK: False
* couldn't load module(s): P
FFTW: True
SCIK: False
REIK: False
* couldn't load module(s): P
Calculating channel alignment...
using slices [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]
making an initial guess for channel 0
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/imgFilters.py:422: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
canvas[slc] = img
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/imgFilters.py:454: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
edges[0] = arr[slc].reshape(smooth_shape)
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/imgFilters.py:458: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
edges[1] = arr[slc].reshape(smooth_shape)
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/imgFilters.py:473: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
edgeArr = edges[s].reshape(arr[slc].shape)
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/imgFilters.py:475: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
arr[slc] = arr[slc] + edgeArr * (smooth - f) # casting rule
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/imgFit.py:504: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
irs = irs[slc]
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/Priithon/fftfuncs.py:15: ComplexWarning: Casting complex values to real discards the imaginary part
return N.fromfunction(f,s).astype(t)
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/xcorr.py:271: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
cc[slc] = c[slc]
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/imgFit.py:83: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
return _fitGaussianND(img[slices], inds, zyx, sigma, mean_max)
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/PriCommon/imgFilters.py:372: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
canvas = arr[slc]
calculating shifts for time 0 channel 0
in iteration, initial geuss is [0.4001541 0. 0. 1. 1. ]
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/alignfuncs.py:348: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
b = b[slc]
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/alignfuncs.py:349: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
c = ref[slc]
0 [0.3811102 0.7740258 0.01413217 1.0004859 1.0014334 ]
1 [0.40044048 0.8696485 0.01787075 1.0006981 1.0030007 ]
2 [0.39966717 0.88733363 0.01683115 1.0008097 1.0045565 ]
3 [0.3988337 0.89325243 0.01640129 1.0008733 1.005868 ]
4 [0.3991665 0.8969632 0.01611541 1.0009098 1.0069597 ]
5 [0.39859203 0.90008795 0.01626075 1.0009304 1.0078628 ]
6 [0.39946604 0.9030446 0.0162031 1.0009431 1.0085973 ]
7 [0.39870858 0.9052475 0.01640198 1.0009494 1.0092126 ]
8 [0.3987756 0.906678 0.01668218 1.0009524 1.0097249 ]
9 [0.3992553 0.9080291 0.01679869 1.000955 1.0101502 ]
10 [0.39893967 0.9091011 0.01678615 1.0009544 1.0104977 ]
11 [0.39850378 0.9103679 0.0167047 1.0009547 1.0107919 ]
12 [0.39920563 0.9111517 0.01682262 1.0009544 1.0110381 ]
13 [0.39923143 0.9118868 0.01693709 1.0009539 1.0112461 ]
14 [0.39894024 0.9123377 0.01697264 1.0009537 1.0114151 ]
15 [0.3988377 0.91268915 0.01699313 1.0009539 1.0115482 ]
16 [0.39890152 0.9131334 0.01703684 1.0009532 1.0116535 ]
17 [0.399267 0.9132327 0.01708041 1.0009527 1.0117468 ]
18 [0.39959422 0.91340154 0.01690532 1.0009538 1.0118295 ]
19 [0.39938307 0.91370744 0.01702445 1.0009527 1.0118954 ]
in iteration, initial geuss is [ 0.4001541 -0.6021366 0. 1. 1. ]
0 [ 0.4205222 -0.6045353 0.00179406 1.0003878 1.0003179 ]
1 [ 0.42666635 -0.6023667 0.00251143 1.0006177 1.000521 ]
2 [ 0.42720982 -0.6016619 0.00254776 1.0007639 1.0006618 ]
3 [ 0.42708898 -0.6017306 0.00236836 1.0008597 1.0007561 ]
4 [ 0.42705783 -0.6014051 0.00228127 1.0009207 1.0008209 ]
time: 0, wave: 0, tx:-0.601, ty:0.427, tz:0.914, r:0.002, mx:1.001, my:1.001, mz:1.012
making an initial guess for channel 2
calculating shifts for time 0 channel 2
in iteration, initial geuss is [-0.02874288 0. 0. 1. 1. ]
0 [-0.09314796 -2.8147223 0.01092087 0.9995497 0.999159 ]
1 [-0.10589518 -2.886521 0.01602565 0.9993089 1.00048 ]
2 [-0.10813547 -2.9106083 0.01812584 0.9991595 1.0015455 ]
3 [-0.10761119 -2.915185 0.01964985 0.99906635 1.0024182 ]
4 [-0.10658425 -2.9149861 0.0206515 0.9990055 1.0031645 ]
5 [-0.1063655 -2.9135764 0.02126585 0.9989637 1.0037847 ]
6 [-0.10566839 -2.9119976 0.0216862 0.998937 1.0043135 ]
7 [-0.10553412 -2.9108958 0.02196223 0.9989188 1.0047569 ]
8 [-0.10538255 -2.9097028 0.02228265 0.99890405 1.005119 ]
9 [-0.1055241 -2.9090524 0.02234417 0.9988959 1.0054238 ]
10 [-0.10508107 -2.9080257 0.02247843 0.9988885 1.0056854 ]
11 [-0.10523181 -2.9073212 0.02256023 0.9988832 1.0059062 ]
12 [-0.10511845 -2.9068835 0.02269662 0.99888 1.0060823 ]
13 [-0.10502494 -2.9064462 0.0228302 0.99887836 1.0062402 ]
14 [-0.10489343 -2.9062479 0.0229932 0.99887663 1.0063736 ]
15 [-0.10460452 -2.9058635 0.02290978 0.9988757 1.0064776 ]
16 [-0.10487421 -2.9055974 0.0228781 0.99887633 1.0065628 ]
17 [-0.10499847 -2.9053001 0.02296025 0.9988766 1.0066354 ]
18 [-0.1051063 -2.9050424 0.02305885 0.9988755 1.0066955 ]
19 [-0.10509229 -2.9048653 0.02309951 0.99887407 1.006752 ]
in iteration, initial geuss is [-0.02874288 0.11845213 0. 1. 1. ]
0 [-0.02341688 0.09982231 0.00770294 0.9997136 0.999604 ]
1 [-0.02432149 0.09111059 0.01200759 0.99950963 0.9993025 ]
2 [-0.02547045 0.08694788 0.01431234 0.99936694 0.9990763 ]
3 [-0.02646762 0.08475978 0.01561404 0.999271 0.99890834]
4 [-0.02748061 0.0830819 0.0164553 0.99920475 0.9987826 ]
5 [-0.02804617 0.08178972 0.01705691 0.9991594 0.9986885 ]
6 [-0.02853557 0.08076619 0.01737379 0.99912775 0.99861974]
7 [-0.02888322 0.07996567 0.0175366 0.99910694 0.9985699 ]
8 [-0.02884387 0.07977514 0.01778476 0.99909276 0.9985333 ]
9 [-0.0290315 0.07938509 0.0178201 0.999083 0.99850583]
time: 0, wave: 2, tx:0.079, ty:-0.029, tz:-2.905, r:0.018, mx:0.999, my:0.999, mz:1.007
/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/aligner.py:845: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
arr = arr[self.cropSlice]
3D phase correlation for time 0 channel 0 iter 0
the result of the last correlation [ 0.05272512 -0.13383454 -0.02574431]
3D phase correlation for time 0 channel 2 iter 0
the result of the last correlation [-0.06243465 -0.11108875 -0.03461928]
Finding affine parameters done!
loading 20180730_Edu_3channel_align-AiryscanProcessing.tif.chromagnon.csv
tif
The Import Error: cannot import name generalIO
error from the previous comment was bypassed by editing the import statements in imgio/init.py, though maybe this will cause something else to break...
#try:
# from . import generalIO, mrcIO, imgSeqIO, multitifIO, bioformatsIO
#except ImportError:
# try:
import generalIO, mrcIO, imgSeqIO, multitifIO, bioformatsIO
# except ImportError:
# from imgio import generalIO, mrcIO, imgSeqIO, multitifIO, bioformatsIO
Hi Josh, I am sorry for the numerous problems and thank you for letting me know your workarounds. What you did for imgio/init.py was perfect for python2.7. I will fix this and the chromagnon command problem in the next release.
Now, the last problem which does not make the aligned image has few clues. Could you let me know what does Chromagnon say for number of time frame for your image file by looking at the "t" column (as marked in this picture)?
Atsushi
No worries, the Mac installation works great! Just trying to run it on our Linux server for longer jobs and avoid moving files around from the server to local machines.
The number of time frame is 1.
When calling chromagnon.py from the command line with --reference and target file arguments the GUI does not open (which is preferred because it allows the script to run in a screen session).
Calling chromagnon.py without arguments opens the GUI. Then running the alignment on the same files generates a more informative error message (ultimately it is TypeError: __init__() got an unexpected keyword argument 'software'
).
Any ideas about this one?
Here is the entire log:
Traceback (most recent call last):
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/threads.py", line 215, in run
out = an.saveAlignedImage()
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/aligner.py", line 932, in saveAlignedImage
des = self.prepSaveFile(fn)
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/aligner.py", line 886, in prepSaveFile
des = imgio.Writer(fn, self.img)
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/imgio/__init__.py", line 43, in Writer
wtr = _switch(fn, read=False, *args, **kwds)
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/imgio/__init__.py", line 98, in _switch
return klasses['tif'](fn, *args, **kwds)
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/imgio/multitifIO.py", line 267, in __init__
generalIO.GeneralWriter.__init__(self, fn, mode)
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/imgio/generalIO.py", line 412, in __init__
GeneralReader.__init__(self, fn, mode)
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/imgio/generalIO.py", line 33, in __init__
self.openFile()
********************************************
File "/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages/Chromagnon/imgio/multitifIO.py", line 275, in openFile
self.fp = tifffile.TiffWriter(self.fn, software=self.software, imagej=imagej)#bigtiff=not(imagej), imagej=imagej)
********************************************
TypeError: __init__() got an unexpected keyword argument 'software'
All the best, j
That helps a lot, thank you!
The problem is a version mismatch of tifffile
.
Could you use tifffile=0.14.0
?
I will also make an update for Chromagnon to adapt tifffile
v0.15.1 in the next release.
Atsushi
I am also installing Chromagnon for scaling up on our Cluster. I have issues for missing modules: 'Priithon' and 'bioformats'
How do I get those 2? I remember seeing those listed as 2 separate packages in the PDF document. Thanks for your time! Here is the terminal line error: (chromatic) naureeng@gpu-380-13:~/Chromagnon$ chromagnon -h
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/nfs/nhome/live/naureeng/.conda/envs/chromatic/lib/python3.5/site-packages/Chromagnon/imgio/bioformatsIO.py", line 23, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/nfs/nhome/live/naureeng/.conda/envs/chromatic/lib/python3.5/site-packages/Chromagnon/imgio/bioformatsIO.py", line 23, in
Thank you for using Chromagnon. I confirmed your problem on our Linux machine, with the current version of Chromagnon (v0.7) Please don't worry about the error, since the program should be running even though the error shows up (I intentionally showed the error, but I should make it as 'warning'). Do you see the command line options after the error message?
If you would like to remove the error message, please install by typing
pip install javabridge python-bioformats
If you had error when installing javabridge, then you may need to install JDK into your conda.
Great, thanks!
How can you do batch processing with Cromagnon? I can do the command line interface for single files.
I call chromagnon from bash inside a Python script.
Note that calling subprocess passes an erroneous 'finished' signal which allows the loop to continue to the next iteration. This spawns multiple parallel instances of Chromagnon and quickly fills up memory and leads to very slow processing.
For large datasets (>20 z-stacks) bash is a better solution, e.g.:
targdir=/Users/joshtitlow/tmp/smFISH_data/smFISH_channel/
refdir=/Users/joshtitlow/tmp/smFISH_data/smFISH_channel/
for image in $targdir*; do
chromagnon $image -R $refdir"${image##*/}" -E dv
done
Cool, thank you so much! I'll use that as an example
The python script is great!
I believe you can also use the command line (though some advanced options are missing).
You can expect the behavior as if you put your files into the reference and target boxes of GUI .
Assuming that you have reference files
reference_1 reference_2 reference_3
and target files
target_1 target_2 target_3
then, you can type
$ chromagnon target_* -R reference_*
(you have to specify the reference files by the -R
option)
This will measure chromatic shift from individual references and apply the parameter to the individual targets one by one.
Alternatively, you may want to average your reference files,
$ chromagnon target_* -R reference_* -a
This will measure chromatic shift from averaged image and apply the same parameter to all target files.
If you got an error using v0.70, please update to v0.71.
Where is v0.71? I do not see it listed in the executable files list.
Right, it is not in the release yet. Please use the green "Clone or download" button in the top page of Chromagnon (https://github.com/macronucleus/Chromagnon), then select "Download ZIP".
Trying to install on Ubuntu 14.04.5.
Ultimately the error is:
pkg_resources.ContextualVersionConflict: (javabridge 1.0.14-1-gdf84bf8 (/usr/people/bioc1301/miniconda2/envs/chromagnon/lib/python2.7/site-packages), Requirement.parse('javabridge>=1.0'), set(['python-bioformats']))
I created a conda environment with all the dependencies:
/src$ conda create -c cyclus -c auto -n chromagnon python=2.7 wxpython=3.0 numpy scipy pyopengl tifffile pyfftw javabridge python-bioformats lxml java-jdk
Cloned the repository from GitHub:
~/src$ git clone https://github.com/macronucleus/Chromagnon.git Cloning into 'Chromagnon'... remote: Counting objects: 543, done. remote: Total 543 (delta 0), reused 0 (delta 0), pack-reused 543 Receiving objects: 100% (543/543), 718.29 KiB | 0 bytes/s, done. Resolving deltas: 100% (324/324), done. Checking connectivity... done.
Installed using the setup file:
~/src/Chromagnon$ python setup.py install
Then try to run chromagnon:
Any ideas? Thanks! Josh