def test_export_import_tiff(self): # kasthuri11/image/xy/3/1000,1100/1000,1100/1000/ image_download = self.oo.get_image('kasthuri11', 'image', 1000, 1100, 1000, 1100, 1000, resolution=3) # if returns string, successful export self.assertEqual( ndtiff.export_tiff("tests/trash/download-1.tiff", image_download), "tests/trash/download-1.tiff") # now confirm import works too self.assertEqual(ndtiff.import_tiff("tests/trash/download-1.tiff")[0][0], image_download[0][0]) self.assertEqual(ndtiff.import_tiff("tests/trash/download-1.tiff")[10][10], image_download[10][10])
# Get all tokens tokens = oo.get_public_tokens() # Membrane group image and annotation tokens for membrane image in datamap image_token = 'kasthuri11cc' annotation_token = 'cv_kasthuri11_membrane_2014' # Get channel ROI for token channel_ROI = nn.get_metadata('cv_kasthuri11_membrane_2014')['channels'] # Get membrane ROI coordinates membrane_group_ROI = channel_ROI['image']['rois']['ac4'] # Sets membrane query in Python membrane_query = { 'token': 'cv_kasthuri11_membrane_2014', 'channel': 'image', 'x_start': membrane_group_ROI['x'][0], 'x_stop': membrane_group_ROI['x'][1], 'y_start': membrane_group_ROI['y'][0], 'y_stop': membrane_group_ROI['y'][1], 'z_start': membrane_group_ROI['z'][0], 'z_stop': membrane_group_ROI['z'][1], 'resolution': membrane_group_ROI['resolution'], } # Sets cutout arguments membrane_images = oo.get_cutout(**membrane_query) ndtiff.export_tiff('membrane_pic1.tiff', membrane_images[0])