Hi Ingmar,
Yes, I can share the code. Here's what I do for switching the mapper:
mitk::BaseRenderer::Pointer pMappingRenderer =
mitk::BaseRenderer::GetInstance(m_pMultiWidget->mitkWidget4->GetRenderWindow());
int nMapperSlot = mitk::BaseRenderer::Standard2D;
typedef mitk::ACCImageMapper2D MapperType;
if
(dynamic_cast<MapperType*>(m_pSelectedNode->GetMapper(nMapperSlot))==0)
{
MapperType::Pointer pMapper = MapperType::New();
MapperType::SetDefaultProperties(m_pSelectedNode);
m_pSelectedNode->SetMapper(nMapperSlot, pMapper);
}
m_pSelectedNode->SetProperty("ACC enable",
mitk::BoolProperty::New(true), pMappingRenderer);
pMappingRenderer->SetMapperID(nMapperSlot);
In my mapper mitk::ACCImageMapper2D (which is derived from mitk::ImageMapper2D)
I do
void ACCImageMapper2D::GenerateData( mitk::BaseRenderer *renderer )
{
bool bACCEnable = false;
GetDataTreeNode()->GetBoolProperty("ACC enable", bACCEnable, renderer);
if (!bACCEnable)
{
Superclass::GenerateData(renderer);
return;
}
[...]
}
That's it.
Best,
Michael.
Siemens AG
Corporate Technology
CT SE 5
Günther-Scharowsky-Str. 1
91058 Erlangen, Deutschland
Tel.: +49 (9131) 7-34627
Fax: +49 (9131) 7-33190
Mobil: +49 (173) 6974642
mailto:[email protected]
Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme;
Vorstand: Peter Löscher, Vorsitzender; Wolfgang Dehen, Heinrich Hiesinger, Joe
Kaeser, Barbara Kux, Hermann Requardt, Siegfried Russwurm, Peter Y. Solmssen;
Sitz der Gesellschaft: Berlin und München, Deutschland; Registergericht: Berlin
Charlottenburg, HRB 12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322
> -----Original Message-----
> From: Wegner Ingmar [mailto:[email protected]]
> Sent: Wednesday, December 02, 2009 2:23 PM
> To: Kelm, Michael
> Subject: AW: Mapper slots and interactors
>
> Hi Michael,
> nice! If you don't mind could you also send the solution for
> the 0.9 version to the users-list so the next user having a
> similar question can find the answer?
>
> Best Regards,
> Ingmar
>
> -------------------------
> Dr. Ingmar Wegner
> German Cancer Research Center (Deutsches
> Krebsforschungszentrum, DKFZ)
> Member of the Helmholtz Association
> Division Medical and Biological Informatics E130
> Im Neuenheimer Feld 280
> D-69120 Heidelberg
> Phone: 49-(0)6221-42-3543
> Fax: 49-(0)6221-42-2345
> E-Mail: [email protected]
> Web: 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.
>
>
> -----Ursprüngliche Nachricht-----
> Von: Kelm, Michael [mailto:[email protected]]
> Gesendet: Mittwoch, 2. Dezember 2009 12:26
> An: Wegner Ingmar
> Betreff: RE: Mapper slots and interactors
>
> Hi Ingmar,
>
> Thanks for your help. I have found a workaround using the
> renderer-selective setting of properties as you suggested: I
> am using a boolean property that tells my mapper to do the
> mapping or to reroute the request to the standard 2D-mapper.
> That way it can run on slot 2, interaction works fine and it
> only acts in the widgets that I want.
>
> Best,
> Michael.
>
> Siemens AG
> Corporate Technology
> CT SE 5
> Günther-Scharowsky-Str. 1
> 91058 Erlangen, Deutschland
> Tel.: +49 (9131) 7-34627
> Fax: +49 (9131) 7-33190
> Mobil: +49 (173) 6974642
> mailto:[email protected]
>
> Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats:
> Gerhard Cromme; Vorstand: Peter Löscher, Vorsitzender;
> Wolfgang Dehen, Heinrich Hiesinger, Joe Kaeser, Barbara Kux,
> Hermann Requardt, Siegfried Russwurm, Peter Y. Solmssen; Sitz
> der Gesellschaft: Berlin und München, Deutschland;
> Registergericht: Berlin Charlottenburg, HRB 12300, München,
> HRB 6684; WEEE-Reg.-Nr. DE 23691322
>
>
>
> > -----Original Message-----
> > From: Wegner Ingmar [mailto:[email protected]]
> > Sent: Monday, November 30, 2009 6:40 PM
> > To: Kelm, Michael; [email protected]
> > Subject: AW: Mapper slots and interactors
> >
> > Hi Michael,
> > ok, this is a rather old mitk version. Did you consider to
> > change to the trunk version? But my colleagues probably also
> > asked you this.
> > As far as I can remember (currently out of office)
> > Widgetspecific properties are available in version 0.9.
> > Thus please try to use mapper slot 2 and directly disable
> > visualization of your desired datatreenode on all other
> > widgets except of the one you want it to show up.
> > Did you try :
> >
> > m_pSelectedNode->SetVisibility(false,
> > mitk::BaseRenderer::GetInstance(m_pMultiWidget->mitkWidget2->G
> etRenderWindow()));
> > m_pSelectedNode->SetVisibility(false,
> > mitk::BaseRenderer::GetInstance(m_pMultiWidget->mitkWidget3->G
> etRenderWindow()));
> > m_pSelectedNode->SetVisibility(false,
> > mitk::BaseRenderer::GetInstance(m_pMultiWidget->mitkWidget4->G
> etRenderWindow()));
> >
> > to hide in widgets 2, 3 and 4?
> >
> > Best Regards,
> > Ingmar
> >
> > P.S. I assume, that the interaction of panning and zooming
> > was limited to mapper slot id == 2 in this early version. If
> > the above won't work, I can check the version for this.
> >
> >
> >
> >
> > ________________________________________
> > Von: Kelm, Michael [[email protected]]
> > Gesendet: Montag, 30. November 2009 11:51
> > An: Wegner Ingmar; [email protected]
> > Betreff: RE: Mapper slots and interactors
> >
> > Hi Ingmar,
> >
> > I tried replacing the default mapper on mapper slot 2. Pan
> > and zoom then works. But then also, all widgets 1-4 use this
> > mapper while I only want to use it in widget no 4.
> >
> > When using a new slot (3), I am setting a mapper on slot 3
> > for all the other data tree nodes as well, as you said.
> > Everything is displayed correctly. Only pan/zoom and the 3D
> > cursor don't work anymore.
> >
> > By which mechanism does MITk determine whether a 3D or 2D
> > interaction scheme is to be used? When I press the mouse
> > button and drag the cursor, e.g., that would move the cursor
> > in a 2D view while in 3D this would rotate the view...
> >
> > My versions:
> > OS: Windows XP
> > MITK: 0.9.2
> > ITK: 3.4.0
> > VTK: 5.0.4
> >
> > Thank you,
> > Michael.
> >
> > Siemens AG
> > Corporate Technology
> > CT SE 5
> > Günther-Scharowsky-Str. 1
> > 91058 Erlangen, Deutschland
> > Tel.: +49 (9131) 7-34627
> > Fax: +49 (9131) 7-33190
> > Mobil: +49 (173) 6974642
> > mailto:[email protected]
> >
> > Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats:
> > Gerhard Cromme; Vorstand: Peter Löscher, Vorsitzender;
> > Wolfgang Dehen, Heinrich Hiesinger, Joe Kaeser, Barbara Kux,
> > Hermann Requardt, Siegfried Russwurm, Peter Y. Solmssen; Sitz
> > der Gesellschaft: Berlin und München, Deutschland;
> > Registergericht: Berlin Charlottenburg, HRB 12300, München,
> > HRB 6684; WEEE-Reg.-Nr. DE 23691322
> >
> >
> > ________________________________
> > From: Wegner Ingmar [mailto:[email protected]]
> > Sent: Monday, November 30, 2009 10:36 AM
> > To: Kelm, Michael; [email protected]
> > Subject: AW: Mapper slots and interactors
> >
> > Hi Michael,
> > you can also replace the default mapper with your own mapper
> > on mapper slot 2.
> > If you have to use a new slot (3) you will also have to
> > instanciate mappers on slot 3 for all other DataTreeNodes if
> > you want the data to be drawn. But Interaction shouldn't be
> > affected by this.
> >
> > Could you specify your system more clearly? OS, MITK / ITK /
> > VTK version.
> >
> > Best Regards,
> > Ingmar
> > -------------------------
> > Dr. Ingmar Wegner
> > German Cancer Research Center (Deutsches
> Krebsforschungszentrum, DKFZ)
> > Member of the Helmholtz Association
> > Division Medical and Biological Informatics E130
> > Im Neuenheimer Feld 280
> > D-69120 Heidelberg
> > Phone: 49-(0)6221-42-3543
> > Fax: 49-(0)6221-42-2345
> > E-Mail: [email protected]
> > Web: 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: Kelm, Michael [mailto:[email protected]]
> > Gesendet: Montag, 30. November 2009 09:41
> > An: Wegner Ingmar; [email protected]
> > Betreff: Re: [mitk-users] Mapper slots and interactors
> >
> > Hi Ingmar,
> >
> > thanks for your answer. Actually I am using my own mapper in
> > slot 3 and since the other three widgets are supposed to use
> > the standard 2D mapper I cannot just overwrite slot 2.
> >
> > My actual problem, however, is that I cannot zoom/pan anymore
> > as soon as I switch widget 4 to mapper slot 3. Do I have to
> > setup something else, related to the interactors?
> >
> > Thank you,
> > Michael.
> >
> > ________________________________
> > From: Wegner Ingmar [mailto:[email protected]]
> > Sent: Sunday, November 29, 2009 8:10 PM
> > To: Kelm, Michael; [email protected]
> > Subject: AW: Mapper slots and interactors
> > Hi Michael,
> > if you define a new mapper slot and set a special mapper on
> > this slot for a specific DataTreeNode, then you willalso need
> > to give all other DataTreeNodes a Mapper on this new slot.
> > Cou can do this by iterating over the tree and setting the
> > mapper on slot 3 eqqual to slot 2.
> >
> > But if you want to visualize a special data in one widget
> > only (widget1), you can also disable the visualization in all
> > other widget by calling:
> >
> > m_pSelectedNode->SetVisibility(false,
> > mitk::BaseRenderer::GetInstance(m_pMultiWidget->mitkWidget2->G
> etRenderWindow()));
> > m_pSelectedNode->SetVisibility(false,
> > mitk::BaseRenderer::GetInstance(m_pMultiWidget->mitkWidget3->G
> etRenderWindow()));
> > m_pSelectedNode->SetVisibility(false,
> > mitk::BaseRenderer::GetInstance(m_pMultiWidget->mitkWidget4->G
> etRenderWindow()));
> >
> > Best Regards,
> > Ingmar
> >
> >
> > Von: Kelm, Michael [mailto:[email protected]]
> > Gesendet: Freitag, 27. November 2009 17:17
> > An: [email protected]
> > Betreff: [mitk-users] Mapper slots and interactors
> >
> >
> > Hello,
> >
> > I have written an own 2D mapper and would like to use it in
> > only one of the 4 render windows.
> > This works fine by setting the third mapper slot of my image
> > data node and by telling the mapping renderer of the fourth
> > window to switch to this slot. Unfortunately, all interactors
> > (pan, zoom, etc.) don't seem to work then. The following code
> > illustrates my problem:
> >
> > mitk::BaseRenderer::Pointer pMappingRenderer =
> > mitk::BaseRenderer::GetInstance(m_pMultiWidget->mitkWidget4->G
> etRenderWindow());
> >
> > int nMapperSlot = 3;
> > if
> > (m_pSelectedNode->GetMapper(nMapperSlot)==0)
> > {
> > typedef mitk::ImageMapper2D
> > MapperType;
> > MapperType::Pointer pMapper =
> > MapperType::New();
> >
> > MapperType::SetDefaultProperties(m_pSelectedNode);
> >
> > m_pSelectedNode->SetMapper(nMapperSlot, pMapper);
> > }
> > pMappingRenderer->SetMapperID(nMapperSlot);
> >
> > What do I have to do to make the 2D interactors work if the
> > third mapper slot is activated?
> >
> > Thank you,
> > Michael.
> >
> >
>
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users