docstr: Align a third image to the first image
docstr_tok: ["Align","a","third","image","to","the","first","image"]
code: def test_03_02_align_separately(self):
      """Align a third image to the first image"""
      np.random.seed(0)
      shape = (47, 53)
      i, j = np.mgrid[0 : shape[0], 0 : shape[1]]
      for offset in ((3, 5), (-3, 5), (3, -5), (-3, -5)):
          image1 = np.random.uniform(size=shape).astype(np.float32)
          image2 = image1[
              (i + shape[0] - offset[0] - 5) % shape[0],
              (j + shape[1] - offset[1] - 5) % shape[1],
          ]
          image3 = image1[
              (i + shape[0] - offset[0]) % shape[0],
              (j + shape[1] - offset[1]) % shape[1],
          ]
          workspace, module = self.make_workspace(
              (image1, image2, image3), (None, None, None)
          )
          assert isinstance(module, Align)
          module.alignment_method.value = M_CROSS_CORRELATION
          module.crop_mode.value = C_PAD
          module.additional_images[0].align_choice.value = A_SEPARATELY
          module.run(workspace)
          m = workspace.measurements
          assert isinstance(m, Measurements)
          off_i0 = -m.get_current_image_measurement(
              "Align_Yshift_Aligned0"
          )
          off_j0 = -m.get_current_image_measurement(
              "Align_Xshift_Aligned0"
          )
          off_i1 = -m.get_current_image_measurement(
              "Align_Yshift_Aligned1"
          )
          off_j1 = -m.get_current_image_measurement(
              "Align_Xshift_Aligned1"
          )
          off_i2 = -m.get_current_image_measurement(
              "Align_Yshift_Aligned2"
          )
          off_j2 = -m.get_current_image_measurement(
              "Align_Xshift_Aligned2"
          )
          assert off_i0 - off_i1 == offset[0] + 5
          assert off_j0 - off_j1 == offset[1] + 5
          assert off_i0 - off_i2 == offset[0]
          assert off_j0 - off_j2 == offset[1]
          output = workspace.image_set.get_image("Aligned2")
          i_slice = self.single_slice_helper(off_i2, shape[0])
          j_slice = self.single_slice_helper(off_j2, shape[1])
          np.testing.assert_almost_equal(
              output.pixel_data[i_slice, j_slice], image3
          )
  
imports: from io import StringIO
  import numpy
  from cellprofiler_core.constants.measurement import COLTYPE_INTEGER
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.modules.align import Align, A_SIMILARLY, A_SEPARATELY, M_MUTUAL_INFORMATION, C_SAME_SIZE, C_CROP, C_PAD, M_CROSS_CORRELATION, MEASUREMENT_FORMAT, C_ALIGN
  from cellprofiler_core.object import ObjectSet
  from cellprofiler_core.pipeline import Pipeline, LoadException
  from cellprofiler_core.preferences import set_headless
  from cellprofiler_core.workspace import Workspace
  from tests.core.modules import read_example_image
  from cellprofiler_core.image import ImageSetList, Image
label_desc: Use image node_id 11 for calling the TestAlign obj's underlying member method code with example usage: obj.test_03_02_align_separately() without return types