Dear Stefan, Thank you for your answer! That was part of the issue, together with two other things:
- Concerning the working data (which you can set as a std::vector of nodes): elsewhere in the code, I set again only one data node as working data... I corrected that, and now the tool manager keeps the two nodes as working data. - Concerning the disappearing mapper: the mapper was reset because I added a new data to the node with node->SetData. Apparently, when you set a new data with a different type than the previous one, all properties (including mappers) are reset. Thank you again! Daphné Le 10/11/2016 à 08:27, Kislinskiy, Stefan a écrit : > Hi, > > I'm not a ToolManager expert, but as far as I know, you can set only one > working data as this is not an array or something like that. If you are > really sure, that one of your nodes doesn't have a mapper, but the other has, > there must be a difference in your code between both nodes. I could imagine > that you are setting the mapper *before* adding the node the the data storage > for the non-working case. When I remember correctly, as soon as you add a > node to the data storage, mappers will be reset. Maybe that's the difference? > > Best, > Stefan > > > -----Original Message----- > From: Daphné Wallach [mailto:daphne.wall...@hrv-simulation.com] > Sent: Mittwoch, 9. November 2016 16:52 > To: Hettich, Martin; mitk-users@lists.sourceforge.net > Subject: Re: [mitk-users] Volume rendering > > Dear Martin, > > This indeed solved the problem, thank you! > > I am now encountering another issue, still with volume rendering, and hope > somebody can help with it as well. > > I don't understand exactly what is going on, so the description will be a bit > verbose... > > Here it goes: > > In a class inheriting from mitk::ToolManager, I create two datanodes and add > them to the datastorage. I create a GPUVolumeMapper3D for each node, and set > the first node as working data. Most of the tools operate on this datanode, > and this node is visible in 3D. So far so good. > > The second node, I set as working data in the activation method of a custom > tool (it is the only tool that operates on this node). But the data from this > node is not visible in 3D, and actually it has no mappers anymore. > > I tried setting both nodes as working data in the class inheriting from tool > manager, but when the custom tool is activated, the tool manager appears to > have only one working data. > > I am completely at loss about what is happening, so if anyone could have an > idea, or suggest some test I can run to see more clearly into this problem, I > would be grateful! > > Daphné > > > Le 09/11/2016 à 12:21, Hettich, Martin a écrit : >> Dear Daphné, >> >> looks like this VTK-issue: >> http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Factories_now_require_defines . >> We fixed this on Friday, October 28. 2016: >> https://phabricator.mitk.org/T20070 , git-commit >> 10bf4f18a76ba41a3079745b58a236523be6885e : >> >> // add this to your mapper's header file to get rid of that nasty, >> unexpected nullptr: >> #include <vtkAutoInit.h> >> VTK_MODULE_INIT(vtkRenderingVolumeOpenGL); >> >> // or add: >> find_package(VTK) >> // and: >> include(${VTK_USE_FILE}) >> // to the corresponding CMakeLists.txt . >> >> Alternatively you could try using the GPU volume renderer by setting >> volumerendering.usegpu to true. >> >> Hope that helps, >> >> Mit freundlichen Grüßen / Kind regards, >> ________________________________________ >> Martin Hettich >> DKFZ-Juniorgruppe Medizinische Bildverarbeitung Student >> >> Deutsches Krebsforschungszentrum >> Stiftung des öffentlichen Rechts >> Im Neuenheimer Feld 280 >> 69120 Heidelberg >> Tel: +49 6221 42-3546 >> Fax: +49 6221 42-2345 >> >> m.hett...@dkfz.de >> www.dkfz.de/de/medizinische-bildverarbeitung >> >> Vorstand: Prof. Dr. Michael Boutros (komm.), Prof. Dr. Josef Puchta >> USt-ID: DE143293537 >> ________________________________________ >> Martin Hettich >> DKFZ Junior Group Medical Image Computing Student >> >> German Cancer Research Center (DKFZ) >> Foundation under Public Law >> Im Neuenheimer Feld 280 >> 69120 Heidelberg >> Germany >> >> phone: +49 6221 42-3546 >> fax: +49 6221 42-2345 >> >> m.hett...@dkfz.de >> http://www.dkfz.de/en/medizinische-bildverarbeitung >> >> Management Board: Prof. Dr. Michael Boutros (interim), Prof. Dr. Josef >> Puchta VAT-ID No.: DE143293537 >> ________________________________________ >> >> ________________________________________ >> Von: Daphné Wallach [daphne.wall...@hrv-simulation.com] >> Gesendet: Mittwoch, 9. November 2016 10:38 >> An: mitk-users@lists.sourceforge.net >> Betreff: [mitk-users] Volume rendering >> >> Dear Mitk users, >> >> I am working on an application using Mitk as a library. For technical >> reasons, I had to use an existing framework and could not develop an >> Mitk module or plug-in. >> >> The aim of the application is to load a DICOM image and segment it. >> >> I am facing an issue with volume rendering: I would like the >> segmentation volume to be visible in 3D, and updated in real time >> (similarly to what exists in the workbench). >> >> Looking into the MITK code, I thought I could simply create a mapper >> and assign it to my data node, but this crashes the code with the >> following >> message: >> >> "Exception caught: reading access violation. >> this->ImageDisplayHelper was nullptr." >> >> The offending line is in the file >> vtkFixedPointVolumeRayCastMapper.cxx, >> l717: >> "this->ImageDisplayHelper->PreMultipliedColorsOn();". >> >> Below is a snippet of my code: >> >> // Created a node called totalDataNode, added it to the datastorage >> mitk::Mapper::Pointer totalMapper; totalMapper = >> mitk::GPUVolumeMapper3D::New(); >> totalMapper->SetDefaultProperties(totalDataNode); >> totalMapper->SetDataNode(totalDataNode); >> totalDataNode->SetMapper(2, totalMapper); >> totalDataNode->SetProperty("volumerendering", >> mitk::BoolProperty::New(true)); >> totalDataNode->SetProperty("volumerendering.uselod", >> mitk::BoolProperty::New(true)); >> totalDataNode->SetProperty("volumerendering.usegpu", >> mitk::BoolProperty::New(false)); >> totalDataNode->SetProperty("volumerendering.useray", >> mitk::BoolProperty::New(false)); >> totalDataNode->SetProperty("volumerendering.usemip", >> mitk::BoolProperty::New(false)); >> >> The line >> totalDataNode->SetProperty("volumerendering", >> mitk::BoolProperty::New(true)); >> triggers the error. >> >> Does anybody know of the correct way to create and use a mapper? I >> would greatly appreciate any help. >> >> Thanks in advance! >> >> Daphné >> >> ---------------------------------------------------------------------- >> -------- Developer Access Program for Intel Xeon Phi Processors Access >> to Intel Xeon Phi processor-based developer platforms. >> With one year of Intel Parallel Studio XE. >> Training and support from Colfax. >> Order your platform today. http://sdm.link/xeonphi >> _______________________________________________ >> mitk-users mailing list >> mitk-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/mitk-users > > ------------------------------------------------------------------------------ > Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon > Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > _______________________________________________ > mitk-users mailing list > mitk-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ mitk-users mailing list mitk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mitk-users