def test_04_03_00_manual_input_range_auto_high(self):
     numpy.random.seed(0)
     expected = numpy.random.uniform(size=(10, 10)).astype(numpy.float32)
     expected[0, 0] = 1
     workspace, module = self.make_workspace(expected / 2 + .1)
     module.rescale_method.value = cellprofiler.modules.rescaleintensity.M_MANUAL_INPUT_RANGE
     module.wants_automatic_low.value = cellprofiler.modules.rescaleintensity.CUSTOM_VALUE
     module.wants_automatic_high.value = cellprofiler.modules.rescaleintensity.HIGH_EACH_IMAGE
     module.source_low.value = .1
     self.assertFalse(module.is_aggregation_module())
     module.run(workspace)
     pixels = workspace.image_set.get_image(OUTPUT_NAME).pixel_data
     numpy.testing.assert_almost_equal(pixels, expected)
 def test_04_03_00_manual_input_range_auto_high(self):
     numpy.random.seed(0)
     expected = numpy.random.uniform(size=(10, 10)).astype(numpy.float32)
     expected[0, 0] = 1
     workspace, module = self.make_workspace(expected / 2 + .1)
     module.rescale_method.value = cellprofiler.modules.rescaleintensity.M_MANUAL_INPUT_RANGE
     module.wants_automatic_low.value = cellprofiler.modules.rescaleintensity.CUSTOM_VALUE
     module.wants_automatic_high.value = cellprofiler.modules.rescaleintensity.HIGH_EACH_IMAGE
     module.source_low.value = .1
     self.assertFalse(module.is_aggregation_module())
     module.run(workspace)
     pixels = workspace.image_set.get_image(OUTPUT_NAME).pixel_data
     numpy.testing.assert_almost_equal(pixels, expected)
 def test_04_02_01_manual_input_range_auto_low_all(self):
     numpy.random.seed(421)
     image1 = numpy.random.uniform(size=(10, 20)).astype(numpy.float32) * .5 + .5
     image2 = numpy.random.uniform(size=(10, 20)).astype(numpy.float32)
     expected = (image1 - numpy.min(image2)) / (1 - numpy.min(image2))
     workspace, module = self.make_workspace([image1, image2])
     self.assertTrue(isinstance(module, cellprofiler.modules.rescaleintensity.RescaleIntensity))
     module.rescale_method.value = cellprofiler.modules.rescaleintensity.M_MANUAL_INPUT_RANGE
     module.wants_automatic_low.value = cellprofiler.modules.rescaleintensity.LOW_ALL_IMAGES
     module.wants_automatic_high.value = cellprofiler.modules.rescaleintensity.CUSTOM_VALUE
     module.source_high.value = 1
     self.assertTrue(module.is_aggregation_module())
     module.prepare_group(workspace, {}, [1, 2])
     module.run(workspace)
     pixels = workspace.image_set.get_image(OUTPUT_NAME).pixel_data
     numpy.testing.assert_almost_equal(pixels, expected)
 def test_04_02_01_manual_input_range_auto_low_all(self):
     numpy.random.seed(421)
     image1 = numpy.random.uniform(size=(10, 20)).astype(
         numpy.float32) * .5 + .5
     image2 = numpy.random.uniform(size=(10, 20)).astype(numpy.float32)
     expected = (image1 - numpy.min(image2)) / (1 - numpy.min(image2))
     workspace, module = self.make_workspace([image1, image2])
     self.assertTrue(
         isinstance(module,
                    cellprofiler.modules.rescaleintensity.RescaleIntensity))
     module.rescale_method.value = cellprofiler.modules.rescaleintensity.M_MANUAL_INPUT_RANGE
     module.wants_automatic_low.value = cellprofiler.modules.rescaleintensity.LOW_ALL_IMAGES
     module.wants_automatic_high.value = cellprofiler.modules.rescaleintensity.CUSTOM_VALUE
     module.source_high.value = 1
     self.assertTrue(module.is_aggregation_module())
     module.prepare_group(workspace, {}, [1, 2])
     module.run(workspace)
     pixels = workspace.image_set.get_image(OUTPUT_NAME).pixel_data
     numpy.testing.assert_almost_equal(pixels, expected)