Ejemplo n.º 1
0
MRFRegistrationDisplay::MRFRegistrationDisplay(QWidget *parent)
: QDialog(parent)
{
	// set some defualt values
	this->gridSpacing = 6.0;
	this->xGridOrigin = 110;
	this->yGridOrigin = 70;

	this->xGridSize = 75;
	this->yGridSize = 75;

	this->resolutionLevels = 3;

	this->labelSteps = 5;
	this->labelInc = 0.33;

	this->maxDisplacement = this->gridSpacing * 0.4;
	this->useSparseSampling = true;
	this->optimiserIterations = 5;
	this->regularisationAmount = 0.1;
	this->metricType = NCC;

	this->mitkImageSeries = NULL;



	this->setupUi(this);

	QFont courier("Courier", 12, QFont::Normal);
	this->registrationTextOutput->setFont(courier);

	connect(this->startRegistrationButton, SIGNAL(pressed()), this, SLOT(startRegistration()));
}
AbstractDBusInterface::AbstractDBusInterface(string interfaceName, string objectPath,
											 GDBusConnection* connection)
	: mInterfaceName(interfaceName), mObjectPath(objectPath), mConnection(connection)
{
	interfaceMap[interfaceName] = this;
	startRegistration();
}
AbstractDBusInterface::AbstractDBusInterface(string interfaceName, string objectName,
											 GDBusConnection* connection)
	: mInterfaceName(interfaceName), mConnection(connection), mPropertyName(objectName), supported(false), zoneFilter(Zone::None), mTime(0), regId(0)
{
	startRegistration();

	mObjectPath = "/" + objectName;
}
bool MRFRegistration2DParametersWidget::initialise(mitk::DataStorage::Pointer storage)
{
	// Populate the combo boxes with the data
	//
	//
	//
	mitk::DataStorage::SetOfObjects::ConstPointer images = storage->GetAll();

	for(unsigned int i = 0; i < images->size(); i++)
	{
		// check that the item is an image
		mitk::Image::Pointer image = mitk::Image::New();
		image = dynamic_cast<mitk::Image*>(images->GetElement(i)->GetData());


		if(image)
		{
			// now break out the slices and times steps
			int timeSteps = image->GetTimeSteps();
			for(int t = 0; t < timeSteps; t++)
			{
				// now break out the z slices
				int zdims = image->GetDimension(2);
				for(int z = 0; z < zdims; z++)
				{
					// we now need to split them up so as to access the
					// 2d slices
					//
					//
					//
					mitk::ImageSliceSelector::Pointer timeImageSelector = mitk::ImageSliceSelector::New();
					timeImageSelector->SetInput(image);
					timeImageSelector->SetTimeNr(t);
					timeImageSelector->SetSliceNr(z);

					try
					{
						timeImageSelector->Update();
					}
					catch(mitk::Exception &e)
					{
						std::cout << "Error in extracting a slice" << std::endl;
						std::cout << e << std::endl;
						break;
					}

					mitk::Image::Pointer imageSlice = timeImageSelector->GetOutput();
					imageSlice->SetGeometry(image->GetGeometry(0));
					imageSlice->Update();
					imageHolder.push_back(imageSlice);

					// add an entry into the combo boxes
					//
					//
					//
					QString entryName = QString::fromStdString(images->GetElement(i)->GetName()) + " z: " + QString::number(z) + " t: " + QString::number(t);
					this->fixedImageSelector->addItem(entryName);
					this->movingImageSelector->addItem(entryName);

				}

			}
		}

	}

	// connect up all the buttons
	connect(this->makeGridButton, SIGNAL(pressed()), this, SLOT(updateGridImage()));
	connect(this->linkDisplacementToGrid, SIGNAL(pressed()), this, SLOT(setMaxDisplacementToGrid()));
	connect(this->resetParamsButton, SIGNAL(pressed()), this, SLOT(resetParams()));
	connect(this->startRegistrationButton, SIGNAL(pressed()), this, SLOT(startRegistration()));

	return true;

}