Transform3D PatientOrientationWidget::get_tMtm() const
{
	Transform3D tMtm;

	if (mInvertButton->isChecked())
	{
		tMtm = createTransformRotateY(M_PI) * createTransformRotateZ(-M_PI / 2);
	}
	else
	{
		tMtm = createTransformRotateY(M_PI) * createTransformRotateZ(M_PI / 2);
	}

	return tMtm;
}
Ejemplo n.º 2
0
  QSize sizeHint() const
  {
    Transform3D M = createTransformRotateX(M_PI_4) *
        createTransformRotateZ(M_PI_4) *
        createTransformTranslate(Vector3D(1,2,M_PI));

    QString text = qstring_cast(M).split("\n")[0];
    QRect rect = QFontMetrics(this->font()).boundingRect(text);
    QSize s(rect.width()*1.0+5, 4*rect.height()*1.2+5);
    return s;
  }
Ejemplo n.º 3
0
/** According to
 * http://www.itksnap.org/pmwiki/pmwiki.php?n=Documentation.ReleaseNotesVersion20 (search NIFTI)
 * http://niftilib.sourceforge.net/ (FAQ item 14)
 *
 * ITK-Snap uses NIfTI coordinates, which have reversed signs on the x and y axis, relative to the DICOM spec.
 * Solve by rotating Z 180 deg.
 */
void ImportDataDialog::convertFromNifti1Coordinates()
{
  if (!mNiftiFormatCheckBox->isChecked())
    return;
  if(!mData)
    return;
  Transform3D rMd = mData->get_rMd();
  rMd = rMd * createTransformRotateZ(M_PI);
  mData->get_rMd_History()->setRegistration(rMd);
  report("Nifti import: rotated input data " + mData->getName() + " 180* around Z-axis.");
}
Ejemplo n.º 4
0
void DecomposedTransform3D::setAngles(Vector3D xyz)
{
	//  std::cout << "setAngles " << xyz << std::endl;

	if (!similar(xyz[0], mAngle[0]))
	{
		m_R = m_R * createTransformRotateX(xyz[0] - mAngle[0]);
		mAngle[0] = xyz[0];
	}
	if (!similar(xyz[1], mAngle[1]))
	{
		m_R = m_R * createTransformRotateY(xyz[1] - mAngle[1]);
		mAngle[1] = xyz[1];
	}
	if (!similar(xyz[2], mAngle[2]))
	{
		m_R = m_R * createTransformRotateZ(xyz[2] - mAngle[2]);
		mAngle[2] = xyz[2];
	}
}
Ejemplo n.º 5
0
/**Provide a nice default transform for displays without a tool.
 */
Transform3D SliceProxy::getSyntheticToolPos(const Vector3D& center) const
{
	Transform3D R_tq = createTransformRotateY(M_PI) * createTransformRotateZ(M_PI_2);
	Transform3D T_c = createTransformTranslate(center);
	return T_c * R_tq;
}