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

« back to all changes in this revision

Viewing changes to src/cadxcore/commands/thumbnailscommand.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:
3
3
*  $Id: thumbnailscommand.cpp $
4
4
*  Ginkgo CADx Project
5
5
*
6
 
*  Copyright 2008-12 MetaEmotion S.L. All rights reserved.
 
6
*  Copyright 2008-14 MetaEmotion S.L. All rights reserved.
7
7
*  http://ginkgo-cadx.com
8
8
*
9
9
*  This file is licensed under LGPL v3 license.
191
191
 
192
192
                        {
193
193
                                //esto es una nyapa para recuperarnos de errores, antes de leer guardamos en bbdd una imagen negra, si finalmente
194
 
                                //el thumbnail se genera bien pues se mete, si no pues se quedara negro
195
 
                                wxImage img(SIZE_THUMBNAILS,SIZE_THUMBNAILS);
 
194
                                //el thumbnail se genera bien pues se mete, si no pues se quedara con unknown
 
195
                                wxImage img = GinkgoResourcesManager::History::GetIcoUnknownFile().ConvertToImage();
196
196
                                m_pThumbParams->m_wxImg = &img;
197
197
                                GuardarImagen();
198
198
                                m_pThumbParams->m_wxImg = NULL;
334
334
 
335
335
                                        }
336
336
                                        else {
337
 
                                                vtkSmartPointer<vtkImageMapToWindowLevelColors> pImageMap = vtkSmartPointer<vtkImageMapToWindowLevelColors>::New();
 
337
                                                vtkSmartPointer<vtkImageMapToColors> pImageMap = vtkSmartPointer<vtkImageMapToColors>::New();
338
338
 
339
339
                                                pImageMap->SetInputConnection(pReslice->GetOutputPort());
340
340
 
349
349
                                                if (timg->GetScalarType() != VTK_UNSIGNED_CHAR) {
350
350
                                                        double window, level;
351
351
                                                        if (loader.GetDefaultWindowLevel(window,level) && window != 0.0) {
352
 
                                                                pImageMap->SetWindow(window);
353
 
                                                                pImageMap->SetLevel(level);
 
352
                                                                double v_min = (level) - 0.5 * window;
 
353
                                                                double v_max = level + 0.5 * window;    
 
354
                                                                pImageMap->GetLookupTable()->SetRange(v_min, v_max);
354
355
                                                        } else {
355
356
                                                                timg->Update();
356
357
                                                                double range[2];
362
363
                                                                level = 0.5*(range[1]+range[0]);
363
364
 
364
365
                                                                if (diff > std::numeric_limits<double>::epsilon()) {
365
 
                                                                        pImageMap->SetWindow(window);
366
 
                                                                        pImageMap->SetLevel(level);
 
366
                                                                        double v_min = (level) - 0.5 * window;
 
367
                                                                        double v_max = level + 0.5 * window;    
 
368
                                                                        pImageMap->GetLookupTable()->SetRange(v_min, v_max);
367
369
                                                                }
368
370
                                                        }
369
371
                                                }
370
372
 
371
373
 
372
374
                                                VTK2ITKfiltro->SetInput( pImageMap->GetOutput());
373
 
 
374
375
                                        }
375
376
                                        NotificarProgreso(0.6f,_Std("Creating Thumbnail..."));
376
377
 
448
449
                        else {
449
450
                                m_pThumbParams->m_pNotificadorThumbnail->SetImage(m_pThumbParams->m_file_pk, m_pThumbParams->m_wxImg);
450
451
                        }
 
452
                } else {
 
453
                        wxImage img =  GinkgoResourcesManager::History::GetIcoUnknownFile().ConvertToImage();
 
454
                        m_pThumbParams->m_pNotificadorThumbnail->SetImage(m_pThumbParams->m_file_pk, &img);
451
455
                }
452
456
        }
453
457