Dear Tobias,

I am sorry to answer your query only now but other things got in the way in the meantime.
I have checked the 4D image and I get:

==========================================
m_Channels = [1]({m_Pointer=0x00000000 })

m_Volumes = [12]({m_Pointer=0x13038d18 },{m_Pointer=0x119f0a60 },{m_Pointer=0x132aa8c0 },{m_Pointer=0x132b0ab8 },{m_Pointer=0x134ac3d8 },...)

m_Slices = [744]({m_Pointer=0x00000000 },{m_Pointer=0x00000000 },{m_Pointer=0x00000000 },{m_Pointer=0x00000000 },{m_Pointer=0x00000000 },...)

m_Dimension = 4
============================================

(do you need to see additional data? I put in only the ones that seemed relevant.)

I find no geometries vector inside the image. Am I not looking at the proper place? Should it be there?
The time stepper keeps giving me -1.

Well, from the above data you can see that the image contains 12 volumes. And, if it can give you more information, I am able to use a timeSelector on it to extract the different timepoints like this:

mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
     timeSelector->SetInput( image );
     timeSelector->SetTimeNr( t );
     timeSelector->Update();

     auxImage = timeSelector->GetOutput();


Is there any place where I can look deeper? For example, where MITK looks into the image geometry before rendering?

Thanks in advance for all the help you can give me.

Best regards,
Samuel


Schwarz Tobias wrote:

Dear Samuel,

the time stepper seems to be correctly created. It should only show -1 when the image has only one timestep.

As far as I remember, it is checked if data is present in the image, and if a valid geometry is present in the corresponding Timeslicedgeometry.

Can you check with a debugger if your 4D image has a valid vector of images and geometries?

Best regards,

Tobias

------------------------------------------------------------

Tobias Schwarz
DKFZ
German Cancer Research Center (Deutsches Krebsforschungszentrum)
Member of the Helmholtz Association
Division of Medical & Biological Informatics E130
Im Neuenheimer Feld 280
D-69120 Heidelberg

Phone: 49-(0)6221-42-2353
Fax: 49-(0)6221-42-2345
E-Mail: [email protected] <mailto:[email protected]>
Web: www.dkfz.de <http://www.dkfz.de>

Confidentiality Note: This message is intended only for the use of the named recipient(s) and may obtain confidential and/or privileged information. If you are not the intended recipient, please contact the sender and delete the message. Any unauthorized use of the information contained in this message is prohibited.

*Von:* Samuel Silva [mailto:[email protected]]
*Gesendet:* Dienstag, 22. September 2009 18:27
*An:* Schwarz Tobias
*Cc:* [email protected]; Wegner Ingmar
*Betreff:* Re: AW: [mitk-users] Creating 4D image from 3D images

Dear Tobias,

Thanks *a lot* for your help. I had been around this problem for some time now and I think I would always miss that detail. It now works well.

As far as I could tell, by what I have read, having a timeslidedgeometry MITK would allow me to deal with the different timepoints in a flash by using the SliceNavigationController present in the QmitkStdMultiWidget.

QmitkSliderNavigatorWidget *sliderNavigatorTime = new QmitkSliderNavigatorWidget( this );
 vlayout_sideWidget->addWidget(sliderNavigatorTime);

 new QmitkStepperAdapter(
    sliderNavigatorTime,
    multiWidget->GetTimeNavigationController()->GetTime(),
    "TimeStepperAdaptor"
  );

Unfortunately, the above code keeps giving me a slider with a -1 (i.e., no access to the multiple timepoints. I manage to have such a slider working for the slices though. It seems that when the SliceNavigatorController is initialized (when the image is loaded) that the geometry it gets has only one timestep.

I am surely missing some simple detail. I'll keep on looking.

Thanks again for your help!

Best regards,
Samuel


Schwarz Tobias wrote:

Dear Samuel,

the code you sent us look almost correct. Only problem I see in the moment is the import of the 3D images into the 4D image.

Instead of the line:

image4D->SetImportVolume(image, i, 0, mitk::Image::ReferenceMemory);

please try the following:

mitkIpPicDescriptor* currentVolume = image->GetVolumeData(0)->GetPicDescriptor();

image4D->SetPicVolume( currentVolume , myTimeStep);

This is because the SetImportVolume function expects a void* of data, if you give it a SmartPointer it will not work correctly.

I hope this can help you,

Best regards,

Tobias

------------------------------------------------------------

Tobias Schwarz
DKFZ
German Cancer Research Center (Deutsches Krebsforschungszentrum)
Member of the Helmholtz Association
Division of Medical & Biological Informatics E130
Im Neuenheimer Feld 280
D-69120 Heidelberg

Phone: 49-(0)6221-42-2353
Fax: 49-(0)6221-42-2345
E-Mail: [email protected] <mailto:[email protected]>
Web: www.dkfz.de <http://www.dkfz.de>

Confidentiality Note: This message is intended only for the use of the named recipient(s) and may obtain confidential and/or privileged information. If you are not the intended recipient, please contact the sender and delete the message. Any unauthorized use of the information contained in this message is prohibited.

* *

*Von:* Samuel Silva [mailto:[email protected]]
*Gesendet:* Montag, 21. September 2009 13:35
*An:* [email protected] <mailto:[email protected]>
*Betreff:* [mitk-users] Creating 4D image from 3D images

Hello!

I posted a question regarding this subject a while ago and since I got no answer I'll get back to it (as I still haven't solved the problem) with a slightly different scenario.

Well, I have a 4D DICOM set which I successfully manage to load (separating the different timepoints and creating a node for each) just by using MITK's code. I can visualize all the loaded 3D images (timepoints) without any problem.

What I now wanted to do (for the sake of better data organization in my app, as I want to load several 4D sets) is to build a 4D MITK image from the 3D images. This way I would only have one item in the DataTree for each 4D set and manage visualization setting the timepoint.

I did something like this:

===============================================================================

void MyApp::fileOpenGetFactoryOutput( mitk::DataTreeNodeFactory & factory, mitk::DataTreeNode::Pointer parentNode)
{
  mitk::DataTreePreOrderIterator it(m_Tree);
  mitk::Image::Pointer image;
  mitk::Image::Pointer firstImage;

  bool dataFound = false;

  mitk::DataTreeNode::Pointer newNode4D = mitk::DataTreeNode::New();
  mitk::Image::Pointer image4D = mitk::Image::New();

mitk::TimeSlicedGeometry::Pointer geom = mitk::TimeSlicedGeometry::New();


  for ( unsigned int i = 0 ; i < factory.GetNumberOfOutputs( ); ++i )
  {
    mitk::DataTreeNode::Pointer node = factory.GetOutput( i );
tmpNodeList.push_back(node); // this is just to get an alternative node list...

    if ( node.IsNotNull( ) )
    {
      image = dynamic_cast<mitk::Image*>(node->GetData());

      if ( image.IsNotNull() && firstImage.IsNull() )
      {
firstImage = image; firstNode = newNode4D;

geom->InitializeEvenlyTimed(image->GetGeometry(), factory.GetNumberOfOutputs( ));
        image4D->Initialize ( image->GetPixelType(), *geom);
}

      if ( node->GetData() != NULL )
      {
        dataFound = true;

image4D->SetImportVolume(image, i, 0, mitk::Image::ReferenceMemory);

      }
    }
  }
newNode4D->SetData( image4D ); //crashes here!!!

        mitk::DataStorage::GetInstance()->Add( newNode4D, parentNode );

m_ToolReferenceDataSelectionBox->UpdateDataDisplay();
        m_ToolWorkingDataSelectionBox->UpdateDataDisplay();

        mitk::RenderingManager::GetInstance()->RequestUpdateAll();



standardViewsInitialized = mitk::RenderingManager::GetInstance()->InitializeViews( &it );

}

==============================================================

Things work OK until newNode4D->SetData( image4D ) where it crashes.

By debugging "inside" the SetData I managed to know that the error occurs in mitk::_ComputeExtremaInItkImage(..), more precisely when inside the while cycle which computes max and min values for the image. At some early point the itkdefaultpixelaccessorfunctor cannot retrieve a pixel value. What can be the reason?

Does the code I present above have any error?
Has anyone tried to do something like this with success?

As far as I could tell, just before the SetData line, image4D has the pointers for all the volumes in m_Volumes set correctly. All other pointer lists (m_Slices, m_Channels) have no pointers in them. I suppose this is normal, since I am setting volumes?

Any idea on what is happening? Things I can do to perform further debugging?

Thanks in advance for all the help!

Samuel

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to