Skip to content

Commit

Permalink
warning messages for single page tiffs
Browse files Browse the repository at this point in the history
  • Loading branch information
epnev committed Jan 29, 2019
1 parent e8b77c8 commit ef7f21c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion caiman/base/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ def load(file_name,fr=30,start_time=0,meta_data=None,subindices=None,shape=None,
except:
logging.warning('Your tif file is saved a single page file. Performance will be affected')
input_arr = tffl.asarray()
input_arr = input_arr[subindices[0]]
input_arr = input_arr[subindices]

else:
input_arr = tffl.asarray()
Expand Down
18 changes: 14 additions & 4 deletions caiman/motion_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def motion_correct_rigid(self, template=None, save_movie=False):
self.shifts_rig: shifts in x and y per frame
"""
logging.debug('Entering Rigid Motion Correction')
logging.debug(-self.min_mov) # XXX why the minus?
logging.debug(-self.min_mov) # XXX why the minus?
self.total_template_rig = template
self.templates_rig = []
self.fname_tot_rig = []
Expand Down Expand Up @@ -2200,7 +2200,7 @@ def motion_correct_batch_rigid(fname, max_shifts, dview=None, splits=56, num_spl
"""
corrected_slicer = slice(subidx.start, subidx.stop, subidx.step * 10)
m = cm.load(fname, subindices=corrected_slicer)

if m.shape[0] < 300:
m = cm.load(fname, subindices=corrected_slicer)
elif m.shape[0] < 500:
Expand All @@ -2209,7 +2209,13 @@ def motion_correct_batch_rigid(fname, max_shifts, dview=None, splits=56, num_spl
else:
corrected_slicer = slice(subidx.start, subidx.stop, subidx.step * 30)
m = cm.load(fname, subindices=corrected_slicer)


if len(m.shape) < 3:
m = cm.load(fname)
m = m[corrected_slicer]
logging.warning("Your original file was saved as a single page " +
"file. Consider saving it in multiple smaller files" +
"with size smaller than 4GB (if it is a .tif file)")
if template is None:
if gSig_filt is not None:
m = cm.movie(
Expand Down Expand Up @@ -2462,7 +2468,11 @@ def motion_correction_piecewise(fname, splits, strides, overlaps, add_to_movie=0
T = len(tf.pages)
if T == 1: # Fiji-generated TIF
is_fiji = True
T, d1, d2 = tf[0].shape
try:
T, d1, d2 = tf[0].shape
except:
T, d1, d2 = tf.asarray().shape
tf.close()
else:
d1, d2 = tf.pages[0].shape

Expand Down

0 comments on commit ef7f21c

Please sign in to comment.