Skip to content

Add transform_nd module  #2397

Open
Open

Description

@stefanv
  1. Add an N-dimensional transform module that supports the rc dimension, extended to N dimensions.
  2. Rebuild skimage.transform to use this module

/cc for comment @scikit-image/core

Activity

  1. soupault commented on Jan 14, 2017

    @soupault
    Member

    What is the purpose of this? Aren't we planning to make, more or less, every algorithm support nd, not just the ones from transform?

  2. jni commented on Jan 15, 2017

    @jni
    Member

    @soupault the problem is that transform uses xy-coordinates, whereas we want the nd version to work on rc coordinates. The idea is to have an n-dimensional transform module with (p)rc coordinates, but keep the old transform module for backwards compatibility. Then later we can deprecate it if needed.

  3. soupault commented on Jan 15, 2017

    @soupault
    Member

    @jni Ah, I see the keypoint.
    👍 from me, and good luck to the devs who will generalize the transforms :).

  4. hmaarrfk commented on Dec 7, 2018

    @hmaarrfk
    Member

    Firstly, thank you all for developing such a cool transform module.

    I wanted to give some feedback based on my experience with it for the better part of the year.
    I know there was some enthusiasm to revamp the transform module, so I wanted to include some feedback on what I thought was missing or problematic. I think this is the best place for it???

    RC vs XY

    I agree wit the move to RC

    __repr__ and __str__

    I think what I struggled with the most is how opaque the classes like ProjectiveTransform are.
    They don't have nice reprs or nice string representations. This makes it really annoying to work with them when you are trying to quickly debug what is going on.

    Closeness to the mathmatical representations

    Homographies have really nice mathematical representations. But for example SimilarityTransform.inverse which you would think is just an other SimilarityTransform is some strange callable that is even more opaque than the original object.

    I understand the desire to support piecewise transforms, but I feel like piecewise transforms are much more niche than the general case of homographies.

    I think this goes back to an earlier request of mine to have the @ operator be supported and dropping the support for the + operator.

    Many classes

    I get why there are different constructors, but there are many *Transforms classes. I think most of them could be summarized by class methods and maybe some use of functools.partial.
    The big advantage here is that it would simplify the upcasting system with + operator.

    Finally, it is unclear what users are "supposed" to use. If I only need a translation, do I use a SimilirityTransform or an AffineTransform. They return different classes, and that might make the code difficult to reuse.

    Having so many classes makes writing __repr__ annoying.

    Example of how to avoid having many classes
    class ProjectiveTransform:
        def __init__(self, param):
            pass
        
        @classmethod
        def SimilirityTransform(cls, param2):
            param = 1
            return cls(param)
        
        
    SimilirityTransform = ProjectiveTransform.SimilirityTransform

    Serialization

    One major challenge in having an "opaque" representation is that it adds friction when serializing results. The choice of having one attribute being params and the input to the constructor being matrix make it really confusing in terms of what the user should use.
    image

    I don't think numpy or python have a good solution to the serialization problem. To me, this is a major drawback of python compared to matlab.

    Personal note

    I've fallen back to representing the homography matrix directly as a 3x3 array, though I get why a class might be desirable.

    • scikit-image version 0.14.1
  5. locked and limited conversation to collaborators on Oct 18, 2021
  6. unlocked this conversation on Apr 5, 2022
  7. reopened this on Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⏩ type: Enhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions