Skip to content

Commit

Permalink
Issue #327 fixed + tests. Was assigning all frames of .stk to first i…
Browse files Browse the repository at this point in the history
…mage.
  • Loading branch information
Lee Kamentsky committed May 16, 2012
1 parent db87d4b commit efbb08e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cellprofiler/modules/loadimages.py
Expand Up @@ -2078,7 +2078,7 @@ def prepare_run_of_movies(self, workspace):
image_index += len(image.channels)
else:
for i in range(frame_count):
list_of_lists[image_index].append(
list_of_lists[image_group_index].append(
(pathname, i, i, image_group_index))
image_set_count = len(list_of_lists[0])
for x,name in zip(list_of_lists[1:], image_names):
Expand Down
29 changes: 29 additions & 0 deletions cellprofiler/modules/tests/test_loadimages.py
Expand Up @@ -2257,6 +2257,35 @@ def test_09_02_load_stk(self):
img2 = image.pixel_data
self.assertEqual(tuple(img2.shape), (1040,1388))
self.assertTrue(np.any(img1!=img2))

def test_09_02_01_load_2_stk(self):
# Regression test of bug 327
path = T.testimages_directory()
files = [os.path.join(path, x) for x in ("C0.stk", "C1.stk")]
if not all([os.path.exists(f) for f in files]):
sys.stderr.write("Warning, could not find test files for STK test: %s\n" % str(files))
return

module = LI.LoadImages()
module.file_types.value = LI.FF_STK_MOVIES
module.images[0].common_text.value = 'C0.stk'
module.images[0].channels[0].image_name.value = 'MyImage'
module.add_imagecb()
module.images[1].common_text.value = 'C1.stk'
module.images[1].channels[0].image_name.value = 'MyOtherImage'

module.location.dir_choice = LI.ABSOLUTE_FOLDER_NAME
module.location.custom_path = path
module.module_num = 1
pipeline = P.Pipeline()
pipeline.add_module(module)
pipeline.add_listener(self.error_callback)
image_set_list = I.ImageSetList()
m = measurements.Measurements()
workspace = W.Workspace(pipeline, module, None, None, m,
image_set_list)
module.prepare_run(workspace)
self.assertEqual(m.image_set_count, 7)

def test_09_03_load_flex(self):
flex_path = T.testimages_directory()
Expand Down

0 comments on commit efbb08e

Please sign in to comment.