Esempio n. 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()));
	}
}
Esempio n. 2
0
/**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();
}
Esempio n. 3
0
void Image::setCroppingBox(const DoubleBoundingBox3D& bb_d)
{
	if (similar(mCroppingBox_d, bb_d))
		return;
	mCroppingBox_d = bb_d;
	emit cropBoxChanged();
}
Esempio n. 4
0
InteractiveCropper::InteractiveCropper(ActiveDataPtr activeData) :
	mActiveData(activeData)
{
	mActiveImageProxy = ActiveImageProxy::New(mActiveData);
	connect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &InteractiveCropper::imageChangedSlot);
	connect(mActiveImageProxy.get(), SIGNAL(cropBoxChanged()), this, SLOT(imageCropChangedSlot()));
}
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();
}
Esempio n. 6
0
// methods for defining and storing a cropping box. Image does not use these data, this is up to the mapper
void Image::setCropping(bool on)
{
	if (mUseCropping == on)
		return;

	mUseCropping = on;
	if (similar(mCroppingBox_d, this->getInitialBoundingBox()))
		mCroppingBox_d = this->boundingBox();
	emit cropBoxChanged();
}