Hi Stefan,

in version 2012.06 we had some problems with corrupt scene files. The reason 
for that was an uninitialized planar figure which is used within the context of 
our 3D interpolation. However as you noticed this issue is resolved with 
version 2012.09. I guess the "someSurface" nodes of your scene file are 
actually mitkPlanarCircles. Their icon in the data manager should be a blue 
circle and they should be named "Position XYZ". In this case your dynamic cast 
for mitkSurfaces would always fail. Could you check that?

Best regards
Andreas

On 05.10.2012, at 18:45, Stefan Dänzer wrote:

Hi,

thanks for the hint about the iterator. Indeed that was missing in my snippet. 
However the cast of the images in the scene files to mitk::image* fails. I did 
some further research about the scene files. They were created using MITK 
workbench 2012-06. When loading the scene files into MITK workbench 2012-09 and 
saved again, the errors at casting to mitk::image* disappear.

Here is the mitk log when loading the files acquired with MITK 2012-06:

tisch@tisch-Precision-M6500:~/lib/MITK/bin/MITK-build/bin$ ./mitkWorkbench
[Fri Oct  5 18:36:51 2012
0.350] Registering PicFileIOFactory
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.LogLevel=2
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:215
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.CacheSize=30
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:217
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.ThreadPoolSize=20
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:219
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.Timeout=5000
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:221
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.RequireTopic=true
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:223
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.LogLevel=2
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:215
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.CacheSize=30
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:217
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.ThreadPoolSize=20
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:219
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.Timeout=5000
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:221
Fri Oct 5 18:36:51 2012 Debug: org.commontk.eventadmin.RequireTopic=true
in startOrUpdate, 
/home/tisch/lib/MITK/bin/CTK-src/Plugins/org.commontk.eventadmin/ctkEAConfiguration.cpp:223
[0.400] Logfile: /home/tisch/.local/share/data/DKFZ/MITK 
Workbench_263351614/data/15/mitk.log
[0.770] [BlueBerry] BlueBerry Workbench ready
#2.360# ERROR: No property reader found for SmartPointerProperty
#2.370# ERROR: There were errors while loding property list file 
/home/tisch/.mitk/SceneIOTempDirectory1572/naaaaa. Your data may be corrupted
#2.370# ERROR: Could not load properties for node.
#2.490# ERROR: No property reader found for SmartPointerProperty
#2.490# ERROR: There were errors while loding property list file 
/home/tisch/.mitk/SceneIOTempDirectory1572/oaaaaa. Your data may be corrupted
#2.490# ERROR: Could not load properties for node.
#2.620# ERROR: No property reader found for SmartPointerProperty
#2.620# ERROR: There were errors while loding property list file 
/home/tisch/.mitk/SceneIOTempDirectory1572/paaaaa. Your data may be corrupted
#2.620# ERROR: Could not load properties for node.
[2.630] Loading /home/tisch/.mitk/SceneIOTempDirectory1572/paaaaa_c5.vtp as vtk
[2.640] [shader.repository] found default mitk shader at 
'/home/tisch/lib/MITK/Core/Code/Rendering'
[2.640] [shader.repository] found shader 'mitkShaderLighting'
[2.660] Loading /home/tisch/.mitk/SceneIOTempDirectory1572/qaaaaa_c4.vtp as vtk
[2.680] Loading /home/tisch/.mitk/SceneIOTempDirectory1572/raaaaa_c3.vtp as vtk
#2.780# ERROR: No property reader found for SmartPointerProperty
#2.780# ERROR: There were errors while loding property list file 
/home/tisch/.mitk/SceneIOTempDirectory1572/taaaaa. Your data may be corrupted
#2.780# ERROR: Could not load properties for node.
#2.880# ERROR: No property reader found for SmartPointerProperty
#2.880# ERROR: There were errors while loding property list file 
/home/tisch/.mitk/SceneIOTempDirectory1572/uaaaaa. Your data may be corrupted
#2.880# ERROR: Could not load properties for node.
[2.890] Loading /home/tisch/.mitk/SceneIOTempDirectory1572/uaaaaa_c7.vtp as vtk
[2.900] Loading /home/tisch/.mitk/SceneIOTempDirectory1572/vaaaaa_c6.vtp as vtk
#2.960# ERROR: There were errors while loding scene file 
/home/tisch/.mitk/SceneIOTempDirectory1572/index.xml. Your data may be corrupted
#2.960# ERROR: There were errors while loding scene file 
/home/tisch/data/4Planitzer/Patient_ap.mitk. Your data may be corrupted

Thanks,

Stefan

On Fri, Oct 5, 2012 at 5:49 PM, Sascha Zelzer 
<[email protected]<mailto:[email protected]>> wrote:
Maybe I just don't see it... where are you incrementing the "objIt" iterator?

- Sascha


On 10/05/2012 01:19 PM, Stefan Dänzer wrote:
Hi all,

I've been trying to write a console application to extract all images (as .mhd) 
and surfaces (as plain text .vtk) contained in a .mitk scene file. However I 
have trouble to extract the corresponding files.

I have linked my application against MITK 2012-09 compiled from source. I can 
open the scene in the mitkWorkbench, so I guess I must be missing something.

The scene layout is as follows:

someImage
|-someSegmentation1
 |-someSurface1
|-someSegmentation2
 |-someSurface2
|-someSegmentation3
 |-someSurface3

where someSurface1 is the child of someSegmentation1 and someSegmentation1 is 
the child of someSegmentation

Here is the snippet from the console app to extract the nodes as vtk-surface or 
mhd-image:


// check if output folder exists, if not create the folder.

  boost::filesystem::path dir( outputFolder);

  if (boost::filesystem::create_directory(dir))

    std::cout << "Created " << outputFolder << "\n";

  else

    std::cout << "Warning could not create " << outputFolder << "\n";

  mitk::SceneIO::Pointer sceneIO = mitk::SceneIO::New();

  mitk::DataStorage::Pointer dataStorage = sceneIO->LoadScene( inputFilename);

  mitk::DataStorage::SetOfObjects::ConstPointer sceneObjs = 
dataStorage->GetAll();

  mitk::DataStorage::SetOfObjects::ConstIterator objIt = sceneObjs->Begin();

  while(objIt != sceneObjs->End())

  {

    mitk::DataNode::Pointer node =  objIt->Value();

    std::cout << node->GetName() << std::endl;

    std::string name = node->GetName();

    std::string path;

    path.append( outputFolder);

    path.append( name);

    // test dynamic_cast to image and to surface.

    if( dynamic_cast<mitk::Image*>( node->GetData()))

    {

      mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(node->GetData());

      mitk::ImageWriter::Pointer imWriter = mitk::ImageWriter::New();

      path.append( ".mhd");

      imWriter->SetInput( image);

      imWriter->SetFileName( path);

      imWriter->Write();

    }

    else if( dynamic_cast<mitk::Surface*>( node->GetData()))

    {

      mitk::Surface::Pointer surface = dynamic_cast<mitk::Surface*>( 
node->GetData());

      mitk::SurfaceVtkWriter<vtkPolyDataWriter>::Pointer surfWriter = 
mitk::SurfaceVtkWriter<vtkPolyDataWriter>::New();

      path.append( ".vtk");

      surfWriter->SetInput( surface);

      surfWriter->SetFileName( path);

      surfWriter->Write();

    }

  }

Thanks for any advice in advance,

Stefan


--
Stefan Daenzer
Körnerplatz 8
04107 Leipzig

Tel.: +49-157-84993879<tel:%2B49-157-84993879>

"Work like you don't need the money, love like you've never been hurt and dance 
like no one is watching." - Randall G Leighton




--
Stefan Daenzer
Körnerplatz 8
04107 Leipzig

Tel.: +49-157-84993879

"Work like you don't need the money, love like you've never been hurt and dance 
like no one is watching." - Randall G Leighton
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to