Skip to content
  • Andras Lasso's avatar
    Allow setting IndexToPhysicalMatrix in vtkImageData · 262eceae
    Andras Lasso authored
    To set image geometry (origin, spacing, directions) developers had to
    call 3 methods. This was:
    - inconvenient: most imaging software stores image geometry
      in a 4x4 homogeneous matrix and need to disassemble the information
      to use the 3 methods
    - inefficient: Modified event is invoked 3 times, so if there are
      observers that react to data change they are triggered 3x for a
      single change
    - may lead to temporary inconsistencies: while setting the geometry,
      Modified event is called twice while the image data has still
      incorrect geometry, neither the previous nor the new one,
      but a mix of the two.
    
    To resolve this, two new methods are added to vtkImageData:
    
        void ApplyIndexToPhysicalMatrix(vtkMatrix4x4* source);
        void ApplyPhysicalToIndexMatrix(vtkMatrix4x4* source);
    
    "Apply" is used instead of "Set" in the method name
    to make it clear that the source matrix is not stored
    as object in the image data but its content is used for
    updating the origin, spacing, and direction matrix.
    262eceae
Loading