Hi Heike, which images exactly do you use? Which MITK version/revision number? The filenames in your code look like you're working with 2d images. Is the effect the same for 2d and 3d images?
Regards Marco -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Heike Moll Gesendet: Donnerstag, 24. Juli 2008 12:57 An: [email protected] Betreff: [mitk-users] Problem with the adapter class Hi all, I have a problem with the adapter classes. I import two images with the mitk application and I register them with ITK (like in Insight/Examples/Registration/ImageRegistration14.cxx). It works as long as the registration process only has to shift the picture but if a rotation is involved it gave bad results. To check my code I imported the same images with the itk imagereader and register them. This works without problems. I convert the mitk images with the adapter AccessTwoImagesFixedDimensionByItk. Can anyone help me to solve my problem ? ///////////////////////// Code ////////////////////////////////////// const mitk::DataTreeNode* FixedImageNode = m_fixedDataTreeFilter->GetSelectedItem()->GetNode(); //get the data if (!FixedImageNode->GetData()) { // Nothing selected. Inform the user and return WARNING_EmptyImageNode(); return false; } //now check the moving image const mitk::DataTreeNode* MovingImageNode = m_movingDataTreeFilter->GetSelectedItem()->GetNode(); if (!MovingImageNode->GetData()) { // Nothing selected. Inform the user and return WARNING_EmptyImageNode(); return false; } // here we have everything valid mitk::BaseData* imageData_f = FixedImageNode->GetData(); mitk::BaseData* imageData_m = MovingImageNode->GetData(); //test if this data item is really an image mitk::Image* image_f = dynamic_cast<mitk::Image*>( imageData_f ); mitk::Image* image_m = dynamic_cast<mitk::Image*>( imageData_m ); if(image_f->GetDimension() != image_m->GetDimension()) return false; const int dim = image_f->GetDimension(); if (image_f && image_m && (dim == 2)){ AccessTwoImagesFixedDimensionByItk( image_f, image_m, itkNormalizedMutualInformation2D, 2 ); } else{ AccessTwoImagesFixedDimensionByItk( image_f, image_m, itkNormalizedMutualInformation3D, 3 ); } template <typename TPixel_f, typename TPixel_m, unsigned int VImageDimension_f, unsigned int VImageDimension_m> void NormalizedMutualInformationRegistration::itkNormalizedMutualInformation2D( itk::Image< TPixel_f, VImageDimension_f >* itkImage_f, itk::Image< TPixel_m, VImageDimension_m >* itkImage_m) { typedef itk::Image< TPixel_f, VImageDimension_f > mitkFixedImageType; typedef itk::Image< TPixel_m, VImageDimension_m > mitkMovingImageType; typedef double PixelType; typedef unsigned char OutputPixelType; const unsigned int Dimension = 2; typedef itk::Image< PixelType, VImageDimension_f > ImageType; typedef itk::Image< PixelType, Dimension > FixedImageType; typedef itk::Image< PixelType, Dimension > MovingImageType; typedef itk::ImageFileReader< FixedImageType > FixedImageReaderType; typedef itk::ImageFileReader< MovingImageType > MovingImageReaderType; typename FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New(); typename MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New(); fixedImageReader->SetFileName( "....png" ); movingImageReader->SetFileName( "....png" ); fixedImageReader->Update(); movingImageReader->Update(); ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
