ZAX130 / SmileCode

The public code of SMILE LAB
30 stars 3 forks source link

Are there any articles that introduce when to use a velocity field and a displacement field? I can't tell these two apart. #10

Closed Pull2MAX closed 3 months ago

Pull2MAX commented 5 months ago

Thank you for your work,are there any articles that introduce when to use a velocity field and a displacement field? I can't tell these two apart.And I don't know when to use velocity field or displacement field. class VecInt(nn.Module):

def __init__(self, inshape, nsteps=7):
    super().__init__()

    assert nsteps >= 0, 'nsteps should be >= 0, found: %d' % nsteps
    self.nsteps = nsteps
    self.scale = 1.0 / (2 ** self.nsteps)
    self.transformer = SpatialTransformer(inshape)

def forward(self, vec):
    vec = vec * self.scale
    for _ in range(self.nsteps):
        vec = vec + self.transformer(vec, vec)
    return vec
ZAX130 commented 5 months ago

Based on my understanding, the current literature often emphasizes the importance of maintaining topology when introducing this module, but lacks guidance on the selection process. In practice, when a sufficiently reasonable deformation field is required (with minimal folding), introducing a velocity field representation can be beneficial. However, as demonstrated in the code snippet, introducing such a velocity field representation incurs additional computational overhead and, empirically, may compromise model accuracy. This presents a trade-off scenario where the choice must be made based on specific contexts, whether prioritizing real-time computation or requiring a more resonable representation.

Pull2MAX commented 5 months ago

Thank you for comments.I've found few articles online about velocity fields, none of them explain it clearly to me. As you mentioned, velocity fields are introduced to preserve topological structures. So, would you recommend understanding the inputs and outputs of this class and using it directly, without focusing on the mathematical details?

ZAX130 commented 5 months ago

The input to the network layer is the same size as the output, meaning that the shape of the deformation field determines the shape of the input velocity field.