~ubuntu-branches/ubuntu/wily/ginkgocadx/wily-proposed

« back to all changes in this revision

Viewing changes to src/cadxcore/export/contracts/ipixelsbluringcontract.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-10-24 21:28:17 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20131024212817-ej1skb9og09d3ht6
Tags: 3.5.0.1137.31+dfsg-1
New upstream release [October 2013]

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
*
 
3
*  $Id: iwindowlevelcontract.cpp $
 
4
*  Ginkgo CADx Project
 
5
*
 
6
*  Copyright 2008-14 MetaEmotion S.L. All rights reserved.
 
7
*  http://ginkgo-cadx.com
 
8
*
 
9
*  This file is licensed under LGPL v3 license.
 
10
*  See License.txt for details
 
11
*
 
12
*/
 
13
#include "ipixelsbluringcontract.h"
 
14
#include <main/controllers/hangingprotocolcontroller.h>
 
15
#include <api/iwidgetsmanager.h>
 
16
#include <api/ivista.h>
 
17
#include <api/istudycontext.h>
 
18
#include <vtk/vtkginkgoimageviewer.h>
 
19
#include <vtkSystemIncludes.h>
 
20
 
 
21
GNC::GCS::IPixelsBluringContract::IPixelsBluringContract() : IWidgetsContract() {
 
22
}
 
23
 
 
24
GNC::GCS::IPixelsBluringContract::~IPixelsBluringContract(){
 
25
}
 
26
 
 
27
void GNC::GCS::IPixelsBluringContract::Setup(const std::string& modality)
 
28
{
 
29
        if (GetManager() != NULL && GetManager()->GetVista() != NULL) {
 
30
                GNC::GCS::Ptr<HangingProtocol> tmpHanging = GetManager()->GetVista()->GetEstudio()->hangingProtocol;
 
31
                if (!tmpHanging.IsValid()) {
 
32
                        tmpHanging = new GNC::GCS::HangingProtocol();
 
33
                }
 
34
                GNC::GCS::Ptr<DefaultModalitySettings> ptr = tmpHanging->getModalitySettings(modality);
 
35
                if (ptr.IsValid()) {
 
36
                        int interpolationMode = VTK_LINEAR_INTERPOLATION;
 
37
                        switch(ptr->getInterpolationMode()) 
 
38
                        {
 
39
                        case GNC::GCS::DefaultModalitySettings::TIM_LINEAR:
 
40
                                interpolationMode = VTK_LINEAR_INTERPOLATION;
 
41
                                break;
 
42
                        case GNC::GCS::DefaultModalitySettings::TIM_NEAREST_NEIGHBOUR:
 
43
                                interpolationMode = VTK_NEAREST_INTERPOLATION;
 
44
                                break;
 
45
                        case GNC::GCS::DefaultModalitySettings::TIM_CUBIC:
 
46
                        //      interpolationMode = VTK_CUBIC_INTERPOLATION;
 
47
                                interpolationMode = 2;//en linux no encuentra cubic
 
48
                                break;
 
49
                        }
 
50
                        GNC::GCS::IWidgetsContract::TViewerList list;
 
51
                        GetAllViewers(list);
 
52
                        for (GNC::GCS::IWidgetsContract::TViewerList::iterator it = list.begin(); it != list.end(); ++it) {
 
53
                                vtkGinkgoImageViewer* pW = (*it);
 
54
                                pW->SetInterpolationMode(interpolationMode);
 
55
                        }
 
56
                }
 
57
 
 
58
        }
 
59
}