void MutualInformationRegistration::calculateVoreenTrafo(const mat4& itkMatrix) {
    const VolumeBase* fixed = fixedVolumeInport_.getData();

    mat4 invertedITKTransform;
    bool success = itkMatrix.invert(invertedITKTransform);
    if(!success) {
        LERROR("Failed to invert ITK transformation matrix!");
        return;
    }
    mat4 f_physicalToWorld = fixed->getPhysicalToWorldMatrix();

    mat4 voreenMatrix = f_physicalToWorld * invertedITKTransform;
    transformationMatrix_.set(voreenMatrix);
    LINFO("Setting matrix");
}
示例#2
0
void Camera::setViewMatrix(const mat4& mvMat) {
    mat4 inv;
    if (mvMat.invert(inv)) {
        // preserve the focallength
        float focallength = length(focus_ - position_);
        
        // calculate world-coordinates
        vec4 pos   = (inv * vec4(0.f, 0.f,  0.f, 1.f));
        vec4 look  = (inv * vec4(0.f, 0.f, -1.f, 0.f));
        vec4 focus = pos + focallength * look;
        vec4 up    = (inv * vec4(0.f, 1.f,  0.f, 0.f));
        
        positionCamera(pos.xyz(), focus.xyz(), up.xyz());
        
        viewMatrix_ = mvMat;
    }
}