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

« back to all changes in this revision

Viewing changes to src/cadxcore/VTKInria3D/vtkVISUManagement/vtkLookupTableManager.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:
36
36
#include "lut/HotIron.h"
37
37
#include "lut/HotGreen.h"
38
38
#include "lut/GEColor.h"
 
39
#include "lut/PERFUSION.h"
39
40
#include "lut/Flow.h"
40
41
#include "lut/LONI.h"
41
42
#include "lut/LONI2.h"
45
46
 
46
47
#include <time.h>
47
48
 
48
 
 
49
49
vtkLookupTableManager::vtkLookupTableManager() {}
50
50
 
51
 
 
52
51
vtkLookupTableManager::~vtkLookupTableManager() {}
53
52
 
54
 
 
55
53
std::list<std::string> vtkLookupTableManager::GetAvailableLookupTables() {
56
 
    std::string lutNames[]={_Std("B/W"),_Std("B/W Inverse"),_Std("Barten"), _Std("Black Body"), _Std("Cardiac"), _Std("VR Bones"), _Std("VR Muscles & Bones"), _Std("VR Red Vessels"), _Std("Gray Rainbow"), _Std("Stern"), _Std("Spectrum"), _Std("Hot Metal"), _Std("Hot Iron"), _Std("Hot Green"), _Std("GE Color"), _Std("Flow"), _Std("LONI"), _Std("LONI2"), _Std("Asymmetry"), _Std("P-Value"), _Std("ROI")};
 
54
    std::string lutNames[]={_Std("B/W"),_Std("B/W Inverse"),_Std("Barten"), _Std("Black Body"), _Std("Cardiac"), _Std("VR Bones"), _Std("VR Muscles & Bones"), _Std("VR Red Vessels"), _Std("Gray Rainbow"), _Std("Stern"), _Std("Spectrum"), _Std("Hot Metal"), _Std("Hot Iron"), _Std("Hot Green"), _Std("GE Color"), _Std("PERFusion"), _Std("PET"), _Std("Flow"), _Std("LONI"), _Std("LONI2"), _Std("Asymmetry"), _Std("P-Value"), _Std("ROI")};
57
55
    std::list<std::string> v_lutNames;
58
 
    for ( int i=0; i<21; i++) {
 
56
    for ( int i=0; i<22; i++) {
59
57
        v_lutNames.push_back(lutNames[i]);
60
58
    }
61
59
 
125
123
                        lut = vtkLookupTableManager::GetGEColorLookupTable();
126
124
                        break;
127
125
 
 
126
                case LUT_PERFUSION:
 
127
                        lut = vtkLookupTableManager::GetPERFusionLookupTable();
 
128
                        break;
 
129
 
 
130
                case LUT_PET:
 
131
                        lut = vtkLookupTableManager::GetPETLookupTable();
 
132
                        break;
 
133
 
128
134
                case LUT_FLOW:
129
135
                        lut = vtkLookupTableManager::GetFlowLookupTable();
130
136
                        break;
448
454
    return lut;
449
455
}
450
456
 
 
457
vtkLookupTable* vtkLookupTableManager::GetPETLookupTable(void) {
 
458
    vtkLookupTable* lut = vtkLookupTable::New();
 
459
    lut->SetNumberOfTableValues(256);
 
460
    
 
461
        lut->Build();
 
462
 
 
463
        for ( int i = 0; i < 256; i++) {
 
464
                if (i < 128) {
 
465
                        lut->SetTableValue(i, (double)(i << 1) / 255.0, 0.0, 0.0, /*(double)(i)/255.0*/ log (1.0+(double)(i)/255.0*9.0)/log (10.0) );
 
466
                }
 
467
                else if (i < 192) {
 
468
                        lut->SetTableValue(i, 1.0, (double) ( (i-128) << 2 ) / 255.0, 0.0, /*(double)(i)/255.0*/ log (1.0+(double)(i)/255.0*9.0)/log (10.0) );
 
469
                }
 
470
                else {
 
471
                        lut->SetTableValue(i, 1.0, 1.0, (double) ( (i-192) << 2 ) / 255.0, /*(double)(i)/255.0*/ log (1.0+(double)(i)/255.0*9.0)/log (10.0) );
 
472
                }        
 
473
    }
 
474
 
 
475
    return lut;
 
476
}
 
477
 
 
478
vtkLookupTable* vtkLookupTableManager::GetPERFusionLookupTable(void) {
 
479
    vtkLookupTable* lut = vtkLookupTable::New();
 
480
    lut->SetNumberOfTableValues(256);
 
481
    
 
482
        lut->Build();
 
483
 
 
484
        const int* R = PERFUSION;
 
485
        const int* G = R + 256;
 
486
        const int* B = G + 256;
 
487
 
 
488
    for ( int i = 0; i < 256; i++) {
 
489
        lut->SetTableValue(i, (double)R[i]/255.0, (double)G[i]/255.0, (double)B[i]/255.0, /*(double)(i)/255.0*/ log (1.0+(double)(i)/255.0*9.0)/log (10.0) );
 
490
    }
 
491
 
 
492
    return lut;
 
493
}
 
494
 
451
495
vtkLookupTable* vtkLookupTableManager::GetROILookupTable() {
452
496
    vtkLookupTable* lut = vtkLookupTable::New();
453
497
    lut->SetNumberOfTableValues (256);