コード例 #1
0
void ActiveImageProxy::activeImageChangedSlot(const QString& uid)
{
	if (mImage && mImage->getUid() == uid)
		return;

	if (mImage)
	{
		disconnect(mImage.get(), SIGNAL(transformChanged()), this, SIGNAL(transformChanged()));
		disconnect(mImage.get(), SIGNAL(propertiesChanged()), this, SIGNAL(propertiesChanged()));
		disconnect(mImage->getLandmarks().get(), SIGNAL(landmarkRemoved(QString)), this, SIGNAL(landmarkRemoved(QString)));
		disconnect(mImage->getLandmarks().get(), SIGNAL(landmarkAdded(QString)), this, SIGNAL(landmarkAdded(QString)));
		disconnect(mImage.get(), SIGNAL(vtkImageDataChanged()), this, SIGNAL(vtkImageDataChanged()));
		disconnect(mImage.get(), SIGNAL(transferFunctionsChanged()), this, SIGNAL(transferFunctionsChanged()));
		disconnect(mImage.get(), SIGNAL(clipPlanesChanged()), this, SIGNAL(clipPlanesChanged()));
		disconnect(mImage.get(), SIGNAL(cropBoxChanged()), this, SIGNAL(cropBoxChanged()));
	}
	mImage = mActiveData->getActive<Image>();
	if (mImage)
	{
		connect(mImage.get(), SIGNAL(transformChanged()), this, SIGNAL(transformChanged()));
		connect(mImage.get(), SIGNAL(propertiesChanged()), this, SIGNAL(propertiesChanged()));
		connect(mImage->getLandmarks().get(), SIGNAL(landmarkRemoved(QString)), this, SIGNAL(landmarkRemoved(QString)));
		connect(mImage->getLandmarks().get(), SIGNAL(landmarkAdded(QString)), this, SIGNAL(landmarkAdded(QString)));
		connect(mImage.get(), SIGNAL(vtkImageDataChanged()), this, SIGNAL(vtkImageDataChanged()));
		connect(mImage.get(), SIGNAL(transferFunctionsChanged()), this, SIGNAL(transferFunctionsChanged()));
		connect(mImage.get(), SIGNAL(clipPlanesChanged()), this, SIGNAL(clipPlanesChanged()));
		connect(mImage.get(), SIGNAL(cropBoxChanged()), this, SIGNAL(cropBoxChanged()));
	}
}
コード例 #2
0
ファイル: cxImage.cpp プロジェクト: normit-nav/CustusX
void Image::setInterpolationType(int val)
{
	if (mThresholdPreview)
		return;
	mInterpolationType = val;
	emit vtkImageDataChanged();
}
コード例 #3
0
ファイル: cxImage.cpp プロジェクト: normit-nav/CustusX
/**Do the following operations on mBaseVtkImageData:
 *  * Reset the origin to zero.
 *  * Reset the extent to have its lower-left corner in zero.
 * The shift introduced by these  two operations are inserted
 * as a translation into the matrix rMd.
 *
 * This operation is needed because Image dont support vtkImageData
 * with a nonzero origin or nonzero extent. These must be removed during creation.
 *
 * Use this method only when you, by using some vtk algorithm, have created a vtkImageData
 * that in nonconform with the Image spec.
 */
void Image::mergevtkSettingsIntosscTransform()
{
	// the internal CustusX format does not handle extents starting at non-zero.
	// Move extent to zero and change rMd.
	Vector3D origin(mBaseImageData->GetOrigin());
	Vector3D spacing(mBaseImageData->GetSpacing());
	IntBoundingBox3D extent(mBaseImageData->GetExtent());
	Vector3D extentShift = multiply_elems(extent.corner(0, 0, 0).cast<double>(), spacing);

	vtkImageChangeInformationPtr info = vtkImageChangeInformationPtr::New();
	info->SetInputData(mBaseImageData);
	info->SetOutputExtentStart(0, 0, 0);
	info->SetOutputOrigin(0, 0, 0);
	info->Update();
	info->UpdateInformation();
	mBaseImageData = info->GetOutput();

	mBaseImageData->ComputeBounds();
//	mBaseImageData->Update();
//	mBaseImageData->UpdateInformation();

	this->get_rMd_History()->setRegistration(this->get_rMd() * createTransformTranslate(origin + extentShift));

	emit vtkImageDataChanged();
	emit clipPlanesChanged();
	emit cropBoxChanged();
}
コード例 #4
0
ファイル: cxImage.cpp プロジェクト: normit-nav/CustusX
void Image::setVtkImageData(const vtkImageDataPtr& data, bool resetTransferFunctions)
{
	mBaseImageData = data;
	mBaseGrayScaleImageData = NULL;
	mHistogramPtr = NULL;

	if (resetTransferFunctions)
		this->resetTransferFunctions();
	emit vtkImageDataChanged();
}
コード例 #5
0
UnsignedDerivedImage::UnsignedDerivedImage(ImagePtr base) : Image(base->getUid()+"_u", vtkImageDataPtr(), base->getName())
{
    this->mBase = base;

    // redirected signals:
    connect(base.get(), SIGNAL(transformChanged()), this, SIGNAL(transformChanged()));
    connect(base.get(), SIGNAL(propertiesChanged()), this, SIGNAL(propertiesChanged()));
    connect(base.get(), SIGNAL(clipPlanesChanged()), this, SIGNAL(clipPlanesChanged()));
    connect(base.get(), SIGNAL(cropBoxChanged()), this, SIGNAL(cropBoxChanged()));

    // override signals:
    connect(base.get(), SIGNAL(transferFunctionsChanged()), this, SLOT(unsignedTransferFunctionsChangedSlot()));
    connect(base.get(), SIGNAL(vtkImageDataChanged()), this, SLOT(unsignedImageChangedSlot()));

	connect(this, SIGNAL(transferFunctionsChanged()), this, SLOT(testSlot()));
	this->unsignedImageChangedSlot();
    this->unsignedTransferFunctionsChangedSlot();
}
コード例 #6
0
ファイル: cxImage.cpp プロジェクト: normit-nav/CustusX
void Image::parseXml(QDomNode& dataNode)
{
	Data::parseXml(dataNode);

	// image node must be parsed in the data manager to create this Image object
	// Only subnodes are parsed here

	if (dataNode.isNull())
		return;

	//transferefunctions
	QDomNode transferfunctionsNode = dataNode.namedItem("transferfunctions");
	if (!transferfunctionsNode.isNull())
		this->getUnmodifiedTransferFunctions3D()->parseXml(transferfunctionsNode);
	else
	{
		std::cout << "Warning: Image::parseXml() found no transferfunctions";
		std::cout << std::endl;
	}

	mInitialWindowWidth = this->loadAttribute(dataNode.namedItem("initialWindow"), "width", -1);
	mInitialWindowLevel = this->loadAttribute(dataNode.namedItem("initialWindow"), "level", -1);

	this->getUnmodifiedLookupTable2D()->parseXml(dataNode.namedItem("lookuptable2D"));

	// backward compatibility:
	mShading.on = dataNode.namedItem("shading").toElement().text().toInt();
	//Assign default values if the shading nodes don't exists to allow backward compability
	if (!dataNode.namedItem("shadingAmbient").isNull())
		mShading.ambient = dataNode.namedItem("shadingAmbient").toElement().text().toDouble();
	if (!dataNode.namedItem("shadingDiffuse").isNull())
		mShading.diffuse = dataNode.namedItem("shadingDiffuse").toElement().text().toDouble();
	if (!dataNode.namedItem("shadingSpecular").isNull())
		mShading.specular = dataNode.namedItem("shadingSpecular").toElement().text().toDouble();
	if (!dataNode.namedItem("shadingSpecularPower").isNull())
		mShading.specularPower = dataNode.namedItem("shadingSpecularPower").toElement().text().toDouble();

	// new way:
	mShading.parseXml(dataNode.namedItem("shading"));

//	mLandmarks->parseXml(dataNode.namedItem("landmarks"));

	QDomElement cropNode = dataNode.namedItem("crop").toElement();
	if (!cropNode.isNull())
	{
		mUseCropping = cropNode.attribute("use").toInt();
		mCroppingBox_d = DoubleBoundingBox3D::fromString(cropNode.text());
	}

	QDomElement clipNode = dataNode.namedItem("clip").toElement();
	QDomElement clipPlaneNode = clipNode.firstChildElement("plane");
	for (; !clipPlaneNode.isNull(); clipPlaneNode = clipPlaneNode.nextSiblingElement("plane"))
	{
		Vector3D normal = Vector3D::fromString(clipPlaneNode.attribute("normal"));
		Vector3D origin = Vector3D::fromString(clipPlaneNode.attribute("origin"));
		vtkPlanePtr plane = vtkPlanePtr::New();
		plane->SetNormal(normal.begin());
		plane->SetOrigin(origin.begin());
		mPersistentClipPlanes.push_back(plane);
	}

	mModality = dataNode.namedItem("modality").toElement().text();
	mImageType = dataNode.namedItem("imageType").toElement().text();

	QDomElement interpoationNode = dataNode.namedItem("vtk_interpolation").toElement();
	if (!interpoationNode.isNull())
	{
		mInterpolationType = interpoationNode.attribute("type").toInt();
		emit vtkImageDataChanged();
	}
}