Changeset 187:97a4f77aa7ae


Ignore:
Timestamp:
03/29/2012 10:40:21 AM (6 years ago)
Author:
Dmitry Fedorov <fedorov@…>
Branch:
default
Phase:
public
Message:

updates for libbioimage

Location:
bioView3D
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • bioView3D/install/install_x64.nsi

    r183 r187  
    1818
    1919; The default installation directory
    20 InstallDir $PROGRAMFILES\CBI\bioView3Dx64
     20InstallDir $PROGRAMFILES\CBI\bioView3D
    2121; Registry key to check for directory (so if you install again, it will
    2222; overwrite the old one automatically)
  • bioView3D/libsrc/libbioimg/formats/meta_format_manager.cpp

    r181 r187  
    6161{
    6262
     63}
     64
     65bool TMetaFormatManager::display_lut_needs_fusion() const {
     66  for (int i=bim::Blue+1; i<(int) bim::NumberDisplayChannels; ++i)
     67    if (display_lut[i] != -1) return true;
     68  return false;
    6369}
    6470
  • bioView3D/libsrc/libbioimg/formats/meta_format_manager.h

    r154 r187  
    6060  const char*  getImagingTime();
    6161
     62  bool         display_lut_needs_fusion() const;
     63
    6264  inline const std::string                 &get_text_metadata() const { return meta_data_text; } 
    6365  inline const DTagMap                     &get_metadata() const      { return metadata; }
  • bioView3D/libsrc/libbioimg/formats/mpeg/debug.h

    r86 r187  
    5555#endif
    5656#include <cstdlib>
     57#include <cstdio>
    5758
    5859
  • bioView3D/libsrc/libbioimg/formats/ole/dim_oib_format_io.cpp

    r154 r187  
    9797}
    9898
     99//****************************************************************************
     100// MISC
     101//****************************************************************************
     102bool oib::Axis::isValid() const {
     103  if (MaxSize<=0) return false;
     104  if (StartPosition == EndPosition) return false;
     105  return true;
     106}
    99107
    100108//****************************************************************************
     
    300308  if (par->axis[4].PixUnit == "ms") par->pixel_resolution[3] /= 1000.0;
    301309
     310  //---------------------------------------------------------------
     311  // image geometry
     312  //---------------------------------------------------------------
     313
    302314  // add Z and T pages
    303315  info->number_pages = 1;
    304   if (axis_count > 3) info->number_pages *= par->axis[3].MaxSize;
    305   if (axis_count > 4) info->number_pages *= par->axis[4].MaxSize;
    306 
    307   info->number_z = std::max(par->axis[3].MaxSize, 1);
    308   info->number_t = std::max(par->axis[4].MaxSize, 1);
    309 
    310   par->num_z = par->axis[3].MaxSize;
    311   par->num_t = par->axis[4].MaxSize;
    312   par->num_l = par->axis[6].MaxSize;
    313 
     316  info->number_z = 1;
     317  info->number_t = 1;
     318
     319  if (axis_count>3 && par->axis[3].isValid()) {
     320    info->number_pages *= par->axis[3].MaxSize;
     321    info->number_z = std::max(par->axis[3].MaxSize, 1);
     322    par->num_z = par->axis[3].MaxSize;
     323  }
     324
     325  if (axis_count>3 && par->axis[4].isValid()) {
     326    info->number_pages *= par->axis[4].MaxSize;
     327    info->number_t = std::max(par->axis[4].MaxSize, 1);
     328    par->num_t = par->axis[4].MaxSize;
     329  }
     330
     331  if (par->axis[6].isValid()) par->num_l = par->axis[6].MaxSize;
     332
     333
     334  //---------------------------------------------------------------
     335  // pixel depth
     336  //---------------------------------------------------------------
    314337  if (info->depth != 16)
    315338    info->pixelType = D_FMT_UNSIGNED;
     
    347370  par->display_lut.resize((int) bim::NumberDisplayChannels, -1);
    348371  for (int i=0; i<(int) bim::NumberDisplayChannels; ++i) par->display_lut[i] = -1;
    349 
     372  std::vector<int> display_prefs(info->samples, -1);
    350373  bool display_channel_set=false;
    351374  for (unsigned int sample=0; sample<info->samples; ++sample) {
     
    369392    else
    370393    if ( r>=1 && g>=1 && b>=1 ) display_channel = bim::Gray;
    371 
     394   
     395    display_prefs[sample] = display_channel;
    372396    if (display_channel>=0) { par->display_lut[display_channel] = sample; display_channel_set=true; }
     397  }
     398
     399  // safeguard for some channels to be hidden by user preferences, in this case, ignore user preference
     400  if (display_channel_set) {
     401    int display=0;
     402    for (int vis=0; vis<bim::NumberDisplayChannels; ++vis)
     403      if (par->display_lut[vis]>-1) ++display;
     404
     405    if (display<std::min<int>(info->samples, bim::NumberDisplayChannels)) {
     406      display_channel_set = false;
     407      for (int i=0; i<(int) bim::NumberDisplayChannels; ++i)
     408        par->display_lut[i] = -1;
     409    }
    373410  }
    374411
  • bioView3D/libsrc/libbioimg/formats/ole/oib.h

    r154 r187  
    3535public:
    3636  Axis(): MaxSize(0), StartPosition(0.0), EndPosition(0.0) { }
    37  
     37
    3838  int MaxSize;
    3939
     
    4949  //CalibrateValueB=0.0
    5050  //ClipPosition=0
     51
     52  bool isValid() const;
    5153};
    5254
  • bioView3D/libsrc/libbioimg/formats_api/dim_histogram.cpp

    r181 r187  
    1818
    1919#include <cmath>
     20#include <limits>
    2021#include <cstring>
    21 #include <limits>
    2222
    2323//******************************************************************************
  • bioView3D/libsrc/libbioimg/formats_api/dim_image.cpp

    r181 r187  
    6161#include <dim_image_win.cpp>
    6262#endif //WIN32
     63
     64#ifdef BIM_USE_ITK
     65#include <bim_image_itk.cpp>
     66#endif //BIM_USE_ITK
    6367
    6468#include "resize.h"
     
    12911295}
    12921296
    1293     // this requires and RGB image
    12941297TDimImage TDimImage::fuseToGrayscale() const {
    1295   if (this->samples()!=3) return TDimImage();
    1296 
    12971298  std::vector< std::vector< std::pair<unsigned int,float> > > mapping;
    12981299  std::vector< std::pair<unsigned int,float> > gray;
    12991300
    1300   gray.push_back( std::make_pair( 0, 0.3f ) );
    1301   gray.push_back( std::make_pair( 1, 0.59f ) );
    1302   gray.push_back( std::make_pair( 2, 0.11f ) );
     1301  if (this->samples()==3) {
     1302    gray.push_back( std::make_pair( 0, 0.3f ) );
     1303    gray.push_back( std::make_pair( 1, 0.59f ) );
     1304    gray.push_back( std::make_pair( 2, 0.11f ) );
     1305  } else {
     1306    for (int i=0; i<this->samples(); ++i)
     1307      gray.push_back( std::make_pair( i, 1.0f ) );
     1308  }
    13031309 
    13041310  mapping.push_back(gray);
    1305 
    13061311  return fuse( mapping );
    13071312}
  • bioView3D/libsrc/libbioimg/formats_api/dim_image.h

    r181 r187  
    5757#include <windows.h>
    5858#endif //WINDOWS
     59
     60#ifdef BIM_USE_ITK
     61#include "itkImage.h"
     62#endif //BIM_USE_ITK
    5963
    6064#include <cmath>
     
    198202    #endif //WIN32
    199203
     204    #ifdef BIM_USE_ITK
     205    template <typename PixelType, class ImageType = itk::Image< PixelType, 2 > >
     206    ImageType::Pointer TDimImage::toItkImage( const unsigned int &channel ) const;
     207
     208    template <typename PixelType, class ImageType = itk::Image< PixelType, 2 > >
     209    void TDimImage::fromItkImage( const ImageType *image );
     210    #endif //BIM_USE_ITK
     211
    200212    #ifdef DIM_USE_IMAGEMANAGER
    201213    bool fromFile( const char *fileName, int page );
Note: See TracChangeset for help on using the changeset viewer.