void mitk::DiffusionImagingActivator::start(ctkPluginContext* context) { Q_UNUSED(context) RegisterDiffusionImagingObjectFactory(); QmitkNodeDescriptorManager* manager = QmitkNodeDescriptorManager::GetInstance(); mitk::NodePredicateDataType::Pointer isDiffusionImage = mitk::NodePredicateDataType::New("DiffusionImage"); QmitkNodeDescriptor* desc = new QmitkNodeDescriptor(QObject::tr("DiffusionImage"), QString(":/QmitkDiffusionImaging/QBallData24.png"), isDiffusionImage, manager); manager->AddDescriptor(desc); mitk::NodePredicateDataType::Pointer isTensorImage = mitk::NodePredicateDataType::New("TensorImage"); manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("TensorImage"), QString(":/QmitkDiffusionImaging/recontensor.png"), isTensorImage, manager)); mitk::NodePredicateDataType::Pointer isQBallImage = mitk::NodePredicateDataType::New("QBallImage"); manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("QBallImage"), QString(":/QmitkDiffusionImaging/reconodf.png"), isQBallImage, manager)); mitk::NodePredicateDataType::Pointer isFiberBundle = mitk::NodePredicateDataType::New("FiberBundle"); manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("FiberBundle"), QString(":/QmitkDiffusionImaging/FiberBundle.png"), isFiberBundle, manager)); mitk::NodePredicateDataType::Pointer isFiberBundleX = mitk::NodePredicateDataType::New("FiberBundleX"); manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("FiberBundleX"), QString(":/QmitkDiffusionImaging/FiberBundleX.png"), isFiberBundleX, manager)); mitk::NodePredicateDataType::Pointer isConnectomicsNetwork = mitk::NodePredicateDataType::New("ConnectomicsNetwork"); manager->AddDescriptor(new QmitkNodeDescriptor(QObject::tr("ConnectomicsNetwork"), QString(":/QmitkDiffusionImaging/ConnectomicsNetwork.png"), isConnectomicsNetwork, manager)); }
/**Documentation * test for the class "mitkNrrdTbssImageWriter". */ int mitkTbssNrrdImageWriterTest(int argc , char* argv[]) { MITK_TEST_BEGIN("TbssNrrdImageWriterTest"); mitk::NrrdTbssImageReader::Pointer tbssNrrdReader = mitk::NrrdTbssImageReader::New(); MITK_TEST_CONDITION_REQUIRED(tbssNrrdReader.GetPointer(), "Testing initialization of test object!"); RegisterDiffusionImagingObjectFactory(); tbssNrrdReader->SetFileName(argv[1]); MITK_TEST_CONDITION_REQUIRED( tbssNrrdReader->CanReadFile(argv[1], "", ""), "Testing CanReadFile() method with valid input file name!"); tbssNrrdReader->Update(); mitk::TbssImage* tbssImg = tbssNrrdReader->GetOutput(0); MITK_TEST_CONDITION_REQUIRED(tbssImg != NULL, "Testing that tbssImg is not null"); mitk::NrrdTbssImageWriter::Pointer tbssNrrdWriter = mitk::NrrdTbssImageWriter::New(); try{ tbssNrrdWriter->SetFileName(argv[2]); tbssNrrdWriter->SetInput(tbssImg); tbssNrrdWriter->Update(); } catch(...) { std::cout << "Writing failed" << std::endl; return EXIT_FAILURE; } mitk::NrrdTbssImageReader::Pointer tbssNrrdReader2 = mitk::NrrdTbssImageReader::New(); tbssNrrdReader2->SetFileName(argv[1]); MITK_TEST_CONDITION_REQUIRED( tbssNrrdReader2->CanReadFile(argv[1], "", ""), "Testing CanReadFile() method with previously saved file!"); tbssNrrdReader2->Update(); mitk::TbssImage* tbssImg2 = tbssNrrdReader2->GetOutput(0); std::vector< std::pair<std::string, int> > groups = tbssImg->GetGroupInfo(); std::vector< std::pair<std::string, int> > groups2 = tbssImg2->GetGroupInfo(); MITK_TEST_CONDITION(groups == groups2, "Check that group information is identical"); mitk::TbssImage::SizeType size = tbssImg->GetLargestPossibleRegion().GetSize(); mitk::TbssImage::SizeType size2 = tbssImg2->GetLargestPossibleRegion().GetSize(); MITK_TEST_CONDITION(size == size2, "Check that sizes are equal"); MITK_TEST_END(); }
/**Documentation * test for the class "mitkNrrdTbssImageReader". */ int mitkTbssRoiNrrdImageReaderTest(int argc , char* argv[]) { MITK_TEST_BEGIN("NrrdTbssRoiImageReaderTest"); mitk::NrrdTbssRoiImageReader::Pointer roiReader = mitk::NrrdTbssRoiImageReader::New(); MITK_TEST_CONDITION_REQUIRED(roiReader.GetPointer(), "Testing initialization of test object!"); RegisterDiffusionImagingObjectFactory(); roiReader->SetFileName(argv[1]); MITK_TEST_CONDITION_REQUIRED( roiReader->CanReadFile(argv[1], "", ""), "Testing CanReadFile() method with valid input file name!"); roiReader->Update(); mitk::TbssRoiImage* roiImg = roiReader->GetOutput(0); MITK_TEST_CONDITION_REQUIRED(roiImg != NULL, "Testing that roiImg is not null"); mitk::TbssRoiImage::SizeType size = roiImg->GetLargestPossibleRegion().GetSize(); MITK_TEST_CONDITION_REQUIRED(size[0]==182 && size[1]==218 && size[2]==182, "Test size of ROI image"); // Test indices of the roi std::vector< itk::Index<3> > indices = roiImg->GetRoi(); MITK_TEST_CONDITION(indices.size() == 24, "Test the number of indices belonging to the Roi"); itk::Index<3> ix = indices.at(0); MITK_TEST_CONDITION(ix[0]==90 && ix[1]==132 && ix[2]==74, "Test whether first index is correct"); ix = indices.at(23); MITK_TEST_CONDITION(ix[0]==90 && ix[1]==117 && ix[2]==88, "Test whether last index is correct"); MITK_TEST_END(); }