本文整理匯總了Python中cellprofiler.modules.loadimages.LoadImages.add_imagecb方法的典型用法代碼示例。如果您正苦於以下問題:Python LoadImages.add_imagecb方法的具體用法?Python LoadImages.add_imagecb怎麽用?Python LoadImages.add_imagecb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cellprofiler.modules.loadimages.LoadImages
的用法示例。
在下文中一共展示了LoadImages.add_imagecb方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_02_01_pipeline_info
# 需要導入模塊: from cellprofiler.modules.loadimages import LoadImages [as 別名]
# 或者: from cellprofiler.modules.loadimages.LoadImages import add_imagecb [as 別名]
def test_02_01_pipeline_info(self):
pipeline = cpp.Pipeline()
load_images = LoadImages()
load_images.module_num = 1
load_images.add_imagecb()
load_images.images[0].channels[0].image_name.value = "Foo"
load_images.images[1].channels[0].image_name.value = "Bar"
pipeline.add_module(load_images)
identify = IdentifyPrimaryObjects()
identify.module_num = 2
identify.image_name.value = "Foo"
identify.object_name.value = "dizzy"
pipeline.add_module(identify)
pipeline_txt = StringIO()
pipeline.savetxt(pipeline_txt)
message = [
zmq.Frame(self.session_id),
zmq.Frame(),
zmq.Frame(PIPELINE_INFO_REQ_1),
zmq.Frame(pipeline_txt.getvalue()),
]
self.socket.send_multipart(message)
message = self.socket.recv_multipart()
self.assertEqual(message.pop(0), self.session_id)
self.assertEqual(message.pop(0), "")
self.assertEqual(message.pop(0), PIPELINE_INFO_REPLY_1)
body = json.loads(message.pop(0))
self.assertEqual(len(body), 3)
channels, type_names, measurements = body
self.assertTrue("Foo" in channels)
self.assertTrue("Bar" in channels)
self.assertTrue("dizzy" in measurements)
found_location = False
found_object_number = False
for feature, idx in measurements["dizzy"]:
if feature == "Location_Center_X":
self.assertEqual("java.lang.Double", type_names[idx])
found_location = True
elif feature == "Number_Object_Number":
self.assertEqual("java.lang.Integer", type_names[idx])
found_object_number = True
self.assertTrue(found_location)
self.assertTrue(found_object_number)
示例2: test_02_03_clean_pipeline
# 需要導入模塊: from cellprofiler.modules.loadimages import LoadImages [as 別名]
# 或者: from cellprofiler.modules.loadimages.LoadImages import add_imagecb [as 別名]
def test_02_03_clean_pipeline(self):
pipeline = cpp.Pipeline()
load_images = LoadImages()
load_images.module_num = 1
load_images.add_imagecb()
load_images.images[0].channels[0].image_name.value = "Foo"
load_images.images[1].channels[0].image_name.value = "Bar"
pipeline.add_module(load_images)
identify = IdentifyPrimaryObjects()
identify.module_num = 2
identify.image_name.value = "Foo"
identify.object_name.value = "dizzy"
pipeline.add_module(identify)
saveimages = SaveImages()
saveimages.module_num = 3
saveimages.image_name.value = "Foo"
pipeline.add_module(saveimages)
measureobjectsizeshape = MeasureObjectSizeShape()
measureobjectsizeshape.module_num = 4
measureobjectsizeshape.object_groups[0].name.value = "dizzy"
pipeline.add_module(measureobjectsizeshape)
pipeline_txt = StringIO()
pipeline.savetxt(pipeline_txt)
module_names = json.dumps([SaveImages.module_name])
message = [
zmq.Frame(self.session_id),
zmq.Frame(),
zmq.Frame(CLEAN_PIPELINE_REQ_1),
zmq.Frame(pipeline_txt.getvalue()),
zmq.Frame(module_names),
]
self.socket.send_multipart(message)
message = self.socket.recv_multipart()
self.assertEqual(message.pop(0), self.session_id)
self.assertEqual(message.pop(0), "")
self.assertEqual(message.pop(0), CLEAN_PIPELINE_REPLY_1)
pipeline_txt = message.pop(0)
pipeline = cpp.Pipeline()
pipeline.loadtxt(StringIO(pipeline_txt))
self.assertEqual(len(pipeline.modules()), 3)
self.assertIsInstance(pipeline.modules()[0], LoadImages)
self.assertIsInstance(pipeline.modules()[1], IdentifyPrimaryObjects)
self.assertIsInstance(pipeline.modules()[2], MeasureObjectSizeShape)