Skip to content

Apply transformation matrix to images with double the resolution, but cannot overlap #233

@rockie-ding

Description

@rockie-ding

Hi @Gibbsdavidl,

Thanks for your wonderful program!

I currently try to align my HE image to MPM image (before registration, they differ in resolution already). However due to large file size, I downsize the resolution to get the registration transformation parameter first, then try to apply the found parameters to original image set (2X the resolution).

I used the get_slide and warp_img function, but after runnning the program, it seems the resulting warped HE and MPM images have different shapes. The error message
"scaling transformation for image with different shape. However, without knowing all of other image's shapes, the scaling may not be the same for all images, and so may not overlap."
pop up, which I think they cannot be registered given different shapes.

Do you know any de-bug to this?

`

Create a Valis object

registrar = registration.Valis(slide_src_dir, results_dst_dir)

Perform registration

rigid_registrar, non_rigid_registrar, error_df = registrar.register(reader_cls=slide_io.BioFormatsSlideReader)

==============================================================================

PART 1: WARP MPM

==============================================================================

slide_obj_mpm = registrar.get_slide('mpm_halfR')
warped_mpm = slide_obj_mpm.warp_img(
img="mpm_fullR.tif",
non_rigid=True,
interp_method='bicubic',
crop='overlap' # Use the standard overlap crop
)

Save MPM

cv2.imwrite(dst_f)

==============================================================================

PART 2: WARP H&E AND RESIZE TO MATCH MPM

==============================================================================

slide_obj_he = registrar.get_slide('he_halfR')
warped_he = slide_obj_he.warp_img(
img="he_fullR.tif",
non_rigid=True,
interp_method='bicubic',
crop='overlap'
)

Save H&E

cv2.imwrite(dst_f)`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions