Open mcongiu opened 4 years ago
I am trying to run hiddenMarkov2D motion correction.
Two months ago I managed without any issue but now I am getting this error:
TypeErrorTraceback (most recent call last) <ipython-input-10-e5b947635e34> in <module>() 3 dataset = correction_approach.correct( 4 sequences, dataset_path, channel_names=['a'], ----> 5 trim_criterion=0.95) 6 7 # Export the time averages for a manuscript figure. C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\sima\motion\motion.pyc in correct(self, dataset, savedir, channel_names, info, correction_channels, trim_criterion) 121 else: 122 mc_sequences = sequences --> 123 displacements = self.estimate(sima.ImagingDataset(mc_sequences, None)) 124 disp_dim = displacements[0].shape[-1] 125 max_disp = np.ceil( C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\sima\imaging.pyc in __init__(self, sequences, savedir, channel_names, read_only) 147 if channel_names is None: 148 self.channel_names = [ --> 149 str(x) for x in range(self.frame_shape[-1])] 150 else: 151 self.channel_names = channel_names C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\sima\imaging.pyc in frame_shape(self) 214 def frame_shape(self): 215 if not hasattr(self, '_frame_shape'): --> 216 self._frame_shape = self.sequences[0].shape[1:] 217 return self._frame_shape 218 C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\sima\sequence.pyc in shape(self) 165 @property 166 def shape(self): --> 167 return (len(self),) + self._get_frame(0).shape 168 169 def apply_displacements(self, displacements, frame_shape=None): C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\sima\sequence.pyc in __len__(self) 584 def __len__(self): 585 if self._len is None: --> 586 self._len = sum(1 for _ in self) 587 return self._len 588 C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\sima\sequence.pyc in <genexpr>((_,)) 584 def __len__(self): 585 if self._len is None: --> 586 self._len = sum(1 for _ in self) 587 return self._len 588 C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\sima\sequence.pyc in __iter__(self) 535 for _ in range(self._num_channels)], 536 axis=2), 0) --> 537 for _ in range(self._num_planes)], 0) 538 539 def _get_frame(self, n): C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\future\builtins\newnext.pyc in newnext(iterator, default) 57 except AttributeError: 58 try: ---> 59 return iterator.next() 60 except AttributeError: 61 raise TypeError("'{0}' object is not an iterator".format( C:\Users\mcongiu\Anaconda3\envs\sima\lib\site-packages\sima\sequence.pyc in _iter_pages(self) 567 else: 568 idx += 1 --> 569 yield np.array(images).astype(float) 570 images.close() 571 TypeError: float() argument must be a string or a number
this is my code:
from __future__ import print_function from builtins import input from builtins import range import sima import sima.motion import sima.segment from sima.ROI import ROIList #import simaWorkflowUtils #ImportError: No module named simaWorkflowUtils import os, sys import json import numpy as np import matplotlib.pyplot as plt %matplotlib inline utils_dir = os.path.join(os.getcwd(), 'utils') sys.path.append(utils_dir) import glob import pandas as pd import itertools basedir = 'C:\\Users\\Data\\2P\\ebc' tif = 'file.tif' tiff_file = os.path.join(basedir, tif) sequences = [sima.Sequence.create('TIFF', tiff_file)] dataset_path = os.path.join(basedir, 'dataset.sima') correction_approach = sima.motion.HiddenMarkov2D(num_states_retained=30, max_displacement=[20, 30]) dataset = correction_approach.correct( sequences, dataset_path, channel_names=['ch'], trim_criterion=0.95) dataset.export_averages([os.path.join(basedir, 'avg.tif')]) dataset.export_frames([[[os.path.join(basedir, 'corrected.tif')]]], fmt='TIFF16')
I am trying to run hiddenMarkov2D motion correction.
Two months ago I managed without any issue but now I am getting this error:
this is my code: