aimsdata  5.0.5
Neuroimaging data handling
threshold.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 /*
35  * Threshold operators
36  */
37 #ifndef AIMS_UTILITY_THRESHOLD_H
38 #define AIMS_UTILITY_THRESHOLD_H
39 
40 #include <iostream>
41 #include <limits>
42 #include <functional>
43 
45 #include <aims/data/data.h>
46 #include <aims/data/pheader.h>
47 #include <aims/mesh/texture.h>
48 
49 
51 {
66 };
67 
93 template <class T,class U>
95 {
96 public:
104  inline AimsThreshold( threshold_t type,T level,T level2 = 0,
105  T backgd = 0,
107  || (std::numeric_limits<U>::max() >= 32767)
108  ? 32767 : std::numeric_limits<U>::max() ) );
109  virtual ~AimsThreshold() {}
110 
112  inline AimsData<T> operator () (const AimsData<T> &sqv);
115  inline AimsData<T> clip(const AimsData<T> &sqv);
117  inline AimsData<U> bin(const AimsData<T> &sqv);
118 
119 protected:
128 };
129 
130 template <class T,class U>
132 {
133 public:
140  inline AimsTexThreshold( threshold_t type,T level,T level2=0, T backgd = 0 );
141  virtual ~AimsTexThreshold() {}
142 
144  inline TimeTexture<T> operator () (const TimeTexture<T> &sqv);
146  inline TimeTexture<U> bin(const TimeTexture<T> &sqv);
147 
148 protected:
156 };
157 
158 template <class T,class U> inline
160  T backgd, U foregd )
161  : _type( type ), _level( level ), _level2( level2 ), _backgd( backgd ), _foregd( foregd )
162 {
163 }
164 
165 template <class T,class U> inline
167  T backgd )
168  : _type( type ), _level( level ), _level2( level2 ), _backgd( backgd )
169 {
170 }
171 
172 namespace internal
173 {
174 
175  template <typename LEFT, typename OP>
176  struct thresh1: public std::unary_function<LEFT, LEFT>
177  {
178  thresh1( LEFT threshold, LEFT background )
179  : std::unary_function<LEFT, LEFT>(), threshold( threshold ),
180  background( background )
181  {
182  }
183 
184  LEFT operator() (const LEFT & x) const
185  {
186  return OP()( x, threshold ) ? x : background;
187  }
188 
189  LEFT threshold;
191  };
192 
193 
194  template <typename T>
196  {
197  bool operator() (const T & x, const T & y, const T & z) const
198  {
199  return x >= y && x <= z;
200  }
201  };
202 
203 
204  template <typename T>
206  {
207  bool operator() (const T & x, const T & y, const T & z) const
208  {
209  return x > y && x <= z;
210  }
211  };
212 
213 
214  template <typename T>
216  {
217  bool operator() (const T & x, const T & y, const T & z) const
218  {
219  return x >= y && x < z;
220  }
221  };
222 
223 
224  template <typename T>
226  {
227  bool operator() (const T & x, const T & y, const T & z) const
228  {
229  return x > y && x < z;
230  }
231  };
232 
233 
234  template <typename T>
236  {
237  bool operator() (const T & x, const T & y, const T & z) const
238  {
239  return x <= y || x >= z;
240  }
241  };
242 
243 
244  template <typename T>
246  {
247  bool operator() (const T & x, const T & y, const T & z) const
248  {
249  return x < y || x >= z;
250  }
251  };
252 
253 
254  template <typename T>
256  {
257  bool operator() (const T & x, const T & y, const T & z) const
258  {
259  return x <= y || x > z;
260  }
261  };
262 
263 
264  template <typename T>
266  {
267  bool operator() (const T & x, const T & y, const T & z) const
268  {
269  return x < y || x > z;
270  }
271  };
272 
273 
274  template <typename LEFT, typename OP>
275  struct thresh2: public std::unary_function<LEFT, LEFT>
276  {
277  thresh2( LEFT threshold1, LEFT threshold2, LEFT background )
278  : std::unary_function<LEFT, LEFT>(), threshold1( threshold1 ),
279  threshold2( threshold2), background( background )
280  {
281  }
282 
283  LEFT operator() (const LEFT & x) const
284  {
285  return OP()( x, threshold1, threshold2 ) ? x : background;
286  }
287 
291  };
292 
293 }
294 
295 template <class T,class U> inline
297 {
298  AimsData<T> res(sqv.dimX(),sqv.dimY(),sqv.dimZ(),sqv.dimT(),
299  sqv.borderWidth());
300  res.setSizeX(sqv.sizeX());
301  res.setSizeY(sqv.sizeY());
302  res.setSizeZ(sqv.sizeZ());
303  res.setSizeT(sqv.sizeT());
304 
305  res = T( 0 );
306 
307  typename AimsData<T>::iterator it1;
308  typename AimsData<T>::const_iterator it2;
309 
310  switch (_type)
311  { case AIMS_LOWER_THAN :
313  *sqv.volume(), *res.volume(),
315  break;
318  *sqv.volume(), *res.volume(),
320  _backgd ) );
321  break;
322  case AIMS_GREATER_THAN :
324  *sqv.volume(), *res.volume(),
326  _backgd ) );
327  break;
330  *sqv.volume(), *res.volume(),
332  _level, _backgd ) );
333  break;
334  case AIMS_EQUAL_TO :
336  *sqv.volume(), *res.volume(),
338  _level, _backgd ) );
339  break;
340  case AIMS_DIFFER :
342  *sqv.volume(), *res.volume(),
344  _level, _backgd ) );
345  break;
346  case AIMS_BETWEEN :
348  *sqv.volume(), *res.volume(),
350  _level, _level2, _backgd ) );
351  break;
354  *sqv.volume(), *res.volume(),
356  _level, _level2, _backgd ) );
357  break;
360  *sqv.volume(), *res.volume(),
362  _level, _level2, _backgd ) );
363  break;
366  *sqv.volume(), *res.volume(),
368  _level, _level2, _backgd ) );
369  break;
370  case AIMS_OUTSIDE :
372  *sqv.volume(), *res.volume(),
374  _level, _level2, _backgd ) );
375  break;
378  *sqv.volume(), *res.volume(),
380  _level, _level2, _backgd ) );
381  break;
384  *sqv.volume(), *res.volume(),
386  _level, _level2, _backgd ) );
387  break;
390  *sqv.volume(), *res.volume(),
392  _level, _level2, _backgd ) );
393  break;
394  }
395 
396  if( sqv.header() )
397  {
398  res.setHeader( sqv.header()->cloneHeader() );
399  aims::PythonHeader *ph
400  = dynamic_cast<aims::PythonHeader *>( res.header() );
401  if( ph && ph->hasProperty( "data_type" ) )
402  ph->removeProperty( "data_type" );
403  }
404  return(res);
405 }
406 
407 namespace internal
408 {
409 
410  template <typename LEFT, typename OP>
411  struct clip1: public std::unary_function<LEFT, LEFT>
412  {
413  clip1( LEFT threshold )
414  : std::unary_function<LEFT, LEFT>(), threshold( threshold )
415  {
416  }
417 
418  LEFT operator() (const LEFT & x) const
419  {
420  return OP()( x, threshold ) ? x : threshold;
421  }
422 
423  LEFT threshold;
424  };
425 
426 
427  template <typename T>
429  {
430  int operator() (const T & x, const T & y, const T & z) const
431  {
432  if( x < y )
433  return -1;
434  return x <= z ? 0 : 1;
435  }
436  };
437 
438 
439  template <typename T>
441  {
442  int operator() (const T & x, const T & y, const T & z) const
443  {
444  if( x <= y )
445  return -1;
446  return x <= z ? 0 : 1;
447  }
448  };
449 
450 
451  template <typename T>
453  {
454  int operator() (const T & x, const T & y, const T & z) const
455  {
456  if( x < y )
457  return -1;
458  return x < z ? 0 : 1;
459  }
460  };
461 
462 
463  template <typename T>
465  {
466  int operator() (const T & x, const T & y, const T & z) const
467  {
468  if( x <= y )
469  return -1;
470  return x < z ? 0 : 1;
471  }
472  };
473 
474 
475  template <typename LEFT, typename OP>
476  struct clip2: public std::unary_function<LEFT, LEFT>
477  {
478  clip2( LEFT threshold1, LEFT threshold2 )
479  : std::unary_function<LEFT, LEFT>(), threshold1( threshold1 ),
480  threshold2( threshold2)
481  {
482  }
483 
484  LEFT operator() (const LEFT & x) const
485  {
486  switch( OP()( x, threshold1, threshold2 ) )
487  {
488  case -1:
489  return threshold1;
490  case 0:
491  return x;
492  case 1:
493  return threshold2;
494  }
495  return x; // should not happen, just avoids a warning.
496  }
497 
500  };
501 
502 }
503 
504 template <class T,class U> inline
506 {
507  AimsData<T> res(sqv.dimX(),sqv.dimY(),sqv.dimZ(),sqv.dimT(),
508  sqv.borderWidth());
509  res.setSizeX(sqv.sizeX());
510  res.setSizeY(sqv.sizeY());
511  res.setSizeZ(sqv.sizeZ());
512  res.setSizeT(sqv.sizeT());
513 
514  res = T( 0 );
515 
516  typename AimsData<T>::iterator it1;
517  typename AimsData<T>::const_iterator it2;
518 
519  switch (_type)
520  { case AIMS_LOWER_THAN :
522  *sqv.volume(), *res.volume(),
524  break;
527  *sqv.volume(), *res.volume(),
529  break;
530  case AIMS_GREATER_THAN :
532  *sqv.volume(), *res.volume(),
534  break;
537  *sqv.volume(), *res.volume(),
539  break;
540  case AIMS_BETWEEN :
542  *sqv.volume(), *res.volume(),
544  _level, _level2 ) );
545  break;
548  *sqv.volume(), *res.volume(),
550  _level, _level2 ) );
551  break;
554  *sqv.volume(), *res.volume(),
556  _level, _level2 ) );
557  break;
560  *sqv.volume(), *res.volume(),
562  _level, _level2 ) );
563  break;
564  case AIMS_OUTSIDE :
568  case AIMS_EQUAL_TO :
569  case AIMS_DIFFER :
570  // Clipping has no real meaning in those cases, thus we do standard
571  // thresholding instead.
572  std::cerr << "Warning: AimsThreshold cannot use clipping with this mode, "
573  "using standard clipping instead." << std::endl;
574  return (*this)(sqv);
575  }
576 
577  if( sqv.header() )
578  {
579  res.setHeader( sqv.header()->cloneHeader() );
580  aims::PythonHeader *ph
581  = dynamic_cast<aims::PythonHeader *>( res.header() );
582  if( ph && ph->hasProperty( "data_type" ) )
583  ph->removeProperty( "data_type" );
584  }
585  return(res);
586 }
587 
588 template <class T,class U> inline
590 {
591 
592  unsigned i, n = sqv.nItem(), t , tm = sqv.size();
593  TimeTexture<T> res = sqv;
594 
595  switch (_type)
596  { case AIMS_LOWER_THAN :
597  for (t = 0; t < tm ; ++t)
598  for (i = 0; i < n ; ++i)
599  res.item( i ) = ( res[t].item( i ) < _level ? res[t].item( i )
600  : _backgd);
601  break;
602  case AIMS_LOWER_OR_EQUAL_TO :
603  for (t = 0; t < tm ; ++t)
604  for (i = 0; i < n ; ++i)
605  res.item( i ) = ( res[t].item( i ) <= _level ? res[t].item( i )
606  : _backgd);
607  break;
608  case AIMS_GREATER_THAN :
609  for (t = 0; t < tm ; ++t)
610  for (i = 0; i < n ; ++i)
611  res.item( i ) = ( res[t].item( i ) > _level ? res[t].item( i )
612  : _backgd);
613  break;
615  for (t = 0; t < tm ; ++t)
616  for (i = 0; i < n ; ++i)
617  res.item( i ) = ( res[t].item( i ) >= _level ? res[t].item( i )
618  : _backgd);
619  break;
620  case AIMS_EQUAL_TO :
621  for (t = 0; t < tm ; ++t)
622  for (i = 0; i < n ; ++i)
623  res.item( i ) = ( res[t].item( i ) == _level ? res[t].item( i )
624  : _backgd);
625  break;
626  case AIMS_DIFFER :
627  for (t = 0; t < tm ; ++t)
628  for (i = 0; i < n ; ++i)
629  res.item( i ) = ( res[t].item( i ) != _level ? res[t].item( i )
630  : _backgd);
631  break;
632  case AIMS_BETWEEN :
633  for (t = 0; t < tm ; ++t)
634  for (i = 0; i < n ; ++i)
635  res.item( i ) = ( res[t].item( i ) >= _level && res[t].item( i )
636  <= _level2 ? res[t].item( i ) : _backgd);
637  break;
639  for (t = 0; t < tm ; ++t)
640  for (i = 0; i < n ; ++i)
641  res.item( i ) = ( res[t].item( i ) > _level && res[t].item( i )
642  <= _level2 ? res[t].item( i ) : _backgd);
643  break;
645  for (t = 0; t < tm ; ++t)
646  for (i = 0; i < n ; ++i)
647  res.item( i ) = ( res[t].item( i ) > _level && res[t].item( i )
648  < _level2 ? res[t].item( i ) : _backgd);
649  break;
651  for (t = 0; t < tm ; ++t)
652  for (i = 0; i < n ; ++i)
653  res.item( i ) = ( res[t].item( i ) > _level && res[t].item( i )
654  < _level2 ? res[t].item( i ) : _backgd);
655  break;
656  case AIMS_OUTSIDE :
657  for (t = 0; t < tm ; ++t)
658  for (i = 0; i < n ; ++i)
659  res.item( i ) = ( res[t].item( i ) < _level || res[t].item( i )
660  > _level2 ? (U) res[t].item( i ) : _backgd);
661  break;
663  for (t = 0; t < tm ; ++t)
664  for (i = 0; i < n ; ++i)
665  res.item( i ) = ( res[t].item( i ) <= _level || res[t].item( i )
666  > _level2 ? (U) res[t].item( i ) : _backgd);
667  break;
669  for (t = 0; t < tm ; ++t)
670  for (i = 0; i < n ; ++i)
671  res.item( i ) = ( res[t].item( i ) < _level || res[t].item( i )
672  >= _level2 ? (U) res[t].item( i ) : _backgd);
673  break;
675  for (t = 0; t < tm ; ++t)
676  for (i = 0; i < n ; ++i)
677  res.item( i ) = ( res[t].item( i ) <= _level || res[t].item( i )
678  >= _level2 ? (U) res[t].item( i ) : _backgd);
679  break;
680  }
681 
682  //No header for the texture yet...
683  /*
684  if( sqv.header() )
685  {
686  res.setHeader( sqv.header()->cloneHeader() );
687  aims::PythonHeader *ph
688  = dynamic_cast<aims::PythonHeader *>( res.header() );
689  if( ph && ph->hasProperty( "data_type" ) )
690  ph->removeProperty( "data_type" );
691  }
692  */
693  return(res);
694 }
695 
696 namespace internal
697 {
698 
699  template <typename LEFT, typename RIGHT, typename OP>
700  struct thresh1_bin: public std::unary_function<LEFT, RIGHT>
701  {
702  thresh1_bin( LEFT threshold, RIGHT foreground )
703  : std::unary_function<LEFT, RIGHT>(), threshold( threshold ),
704  foreground( foreground )
705  {
706  }
707 
708  RIGHT operator() (const LEFT & x) const
709  {
710  return OP()( x, threshold ) ? foreground : 0;
711  }
712 
713  LEFT threshold;
714  RIGHT foreground;
715  };
716 
717 
718  template <typename LEFT, typename RIGHT, typename OP>
719  struct thresh2_bin: public std::unary_function<LEFT, RIGHT>
720  {
721  thresh2_bin( LEFT threshold1, LEFT threshold2, RIGHT foreground )
722  : std::unary_function<LEFT, RIGHT>(), threshold1( threshold1 ),
723  threshold2( threshold2 ), foreground( foreground )
724  {
725  }
726 
727  RIGHT operator() (const LEFT & x) const
728  {
729  return OP()( x, threshold1, threshold2 ) ? foreground : 0;
730  }
731 
734  RIGHT foreground;
735  };
736 
737 }
738 
739 template <class T,class U> inline
741 {
742  AimsData<U> res(sqv.dimX(),sqv.dimY(),sqv.dimZ(),sqv.dimT(),
743  sqv.borderWidth());
744  res.setSizeX(sqv.sizeX());
745  res.setSizeY(sqv.sizeY());
746  res.setSizeZ(sqv.sizeZ());
747  res.setSizeT(sqv.sizeT());
748 
749  res = U( 0 );
750 
751  typename AimsData<U>::iterator it1;
752  typename AimsData<T>::const_iterator it2;
753 
754  switch (_type)
755  {
756 
757  case AIMS_LOWER_THAN :
759  *sqv.volume(), *res.volume(),
761  _level, _foregd ) );
762  break;
763  case AIMS_LOWER_OR_EQUAL_TO :
765  *sqv.volume(), *res.volume(),
767  _level, _foregd ) );
768  break;
769  case AIMS_GREATER_THAN :
771  *sqv.volume(), *res.volume(),
773  _level, _foregd ) );
774  break;
777  *sqv.volume(), *res.volume(),
779  _level, _foregd ) );
780  break;
781  case AIMS_EQUAL_TO :
783  *sqv.volume(), *res.volume(),
785  _level, _foregd ) );
786  break;
787  case AIMS_DIFFER :
789  *sqv.volume(), *res.volume(),
791  _level, _foregd ) );
792  break;
793  case AIMS_BETWEEN :
795  *sqv.volume(), *res.volume(),
797  _level, _level2, _foregd ) );
798  break;
801  *sqv.volume(), *res.volume(),
803  _level, _level2, _foregd ) );
804  break;
807  *sqv.volume(), *res.volume(),
809  _level, _level2, _foregd ) );
810  break;
813  *sqv.volume(), *res.volume(),
815  _level, _level2, _foregd ) );
816  break;
817  case AIMS_OUTSIDE :
819  *sqv.volume(), *res.volume(),
821  _level, _level2, _foregd ) );
822  break;
825  *sqv.volume(), *res.volume(),
827  _level, _level2, _foregd ) );
828  break;
831  *sqv.volume(), *res.volume(),
833  _level, _level2, _foregd ) );
834  break;
837  *sqv.volume(), *res.volume(),
839  _level, _level2, _foregd ) );
840  break;
841  }
842 
843  if( sqv.header() )
844  {
845  res.setHeader( sqv.header()->cloneHeader() );
846  aims::PythonHeader *ph
847  = dynamic_cast<aims::PythonHeader *>( res.header() );
848  if( ph && ph->hasProperty( "data_type" ) )
849  ph->removeProperty( "data_type" );
850  }
851  return(res);
852 }
853 
854 template <class T,class U> inline
856 {
857  unsigned i, n = sqv.nItem(), t , tm = sqv.size();
858  TimeTexture<T> temp = sqv ;
859  TimeTexture<U> res;
860 
861  switch (_type)
862  { case AIMS_LOWER_THAN :
863  for (t = 0; t < tm ; ++t)
864  for (i = 0; i < n ; ++i)
865  if ( temp[t].item( i ) < _level)
866  res[t].push_back( 1 );
867  else
868  res[t].push_back( 0 );
869 
870  break;
871  case AIMS_LOWER_OR_EQUAL_TO :
872  for (t = 0; t < tm ; ++t)
873  for (i = 0; i < n ; ++i)
874  if ( temp[t].item( i ) <= _level)
875  res[t].push_back( 1 );
876  else
877  res[t].push_back( 0 );
878  break;
879  case AIMS_GREATER_THAN :
880  for (t = 0; t < tm ; ++t)
881  for (i = 0; i < n ; ++i)
882  if ( temp[t].item( i ) > _level)
883  res[t].push_back( 1 );
884  else
885  res[t].push_back( 0 );
886  break;
888  for (t = 0; t < tm ; ++t)
889  for (i = 0; i < n ; ++i)
890  if ( temp[t].item( i ) >= _level)
891  res[t].push_back( 1 );
892  else
893  res[t].push_back( 0 );
894  break;
895  case AIMS_EQUAL_TO :
896  for (t = 0; t < tm ; ++t)
897  for (i = 0; i < n ; ++i)
898  if ( temp[t].item( i ) == _level)
899  res[t].push_back( 1 );
900  else
901  res[t].push_back( 0 );
902  break;
903  case AIMS_DIFFER :
904  for (t = 0; t < tm ; ++t)
905  for (i = 0; i < n ; ++i)
906  if ( temp[t].item( i ) != _level)
907  res[t].push_back( 1 );
908  else
909  res[t].push_back( 0 );
910  break;
911  case AIMS_BETWEEN :
912  for (t = 0; t < tm ; ++t)
913  for (i = 0; i < n ; ++i)
914  if ( temp[t].item( i ) >= _level
915  && temp[t].item( i ) <= _level2 )
916  res[t].push_back( 1 );
917  else
918  res[t].push_back( 0 );
919  break;
921  for (t = 0; t < tm ; ++t)
922  for (i = 0; i < n ; ++i)
923  if ( temp[t].item( i ) > _level
924  && temp[t].item( i ) <= _level2 )
925  res[t].push_back( 1 );
926  else
927  res[t].push_back( 0 );
928  break;
930  for (t = 0; t < tm ; ++t)
931  for (i = 0; i < n ; ++i)
932  if ( temp[t].item( i ) >= _level
933  && temp[t].item( i ) < _level2 )
934  res[t].push_back( 1 );
935  else
936  res[t].push_back( 0 );
937  break;
939  for (t = 0; t < tm ; ++t)
940  for (i = 0; i < n ; ++i)
941  if ( temp[t].item( i ) > _level
942  && temp[t].item( i ) < _level2 )
943  res[t].push_back( 1 );
944  else
945  res[t].push_back( 0 );
946  break;
947  case AIMS_OUTSIDE :
948  for (t = 0; t < tm ; ++t)
949  for (i = 0; i < n ; ++i)
950  if ( temp[t].item( i ) < _level
951  && temp[t].item( i ) > _level2 )
952  res[t].push_back( 1 );
953  else
954  res[t].push_back( 0 );
955  break;
957  for (t = 0; t < tm ; ++t)
958  for (i = 0; i < n ; ++i)
959  if ( temp[t].item( i ) <= _level
960  && temp[t].item( i ) > _level2 )
961  res[t].push_back( 1 );
962  else
963  res[t].push_back( 0 );
964  break;
966  for (t = 0; t < tm ; ++t)
967  for (i = 0; i < n ; ++i)
968  if ( temp[t].item( i ) < _level
969  && temp[t].item( i ) >= _level2 )
970  res[t].push_back( 1 );
971  else
972  res[t].push_back( 0 );
973  break;
975  for (t = 0; t < tm ; ++t)
976  for (i = 0; i < n ; ++i)
977  if ( temp[t].item( i ) <= _level
978  && temp[t].item( i ) >= _level2 )
979  res[t].push_back( 1 );
980  else
981  res[t].push_back( 0 );
982  break;
983  }
984 
985  //No header for the texture yet...
986  /*
987  if( sqv.header() )
988  {
989  res.setHeader( sqv.header()->cloneHeader() );
990  aims::PythonHeader *ph
991  = dynamic_cast<aims::PythonHeader *>( res.header() );
992  if( ph && ph->hasProperty( "data_type" ) )
993  ph->removeProperty( "data_type" );
994  }
995  */
996  return(res);
997 }
998 
999 
1000 #endif
const T * const_iterator
basic constant iterator
int dimZ() const
Attributed python-like header, stores all needed information about an object, currently used for volu...
Definition: pheader.h:51
void push_back(const T &item)
Definition: texture.h:154
T _level
Lower level or unique level.
Definition: threshold.h:123
T * iterator
basic iterator
float sizeZ() const
STL namespace.
int dimY() const
float sizeT() const
AimsThreshold(threshold_t type, T level, T level2=0, T backgd=0, U foregd=(U)(!std::numeric_limits< U >::is_specialized||(std::numeric_limits< U >::max() >=32767) ? 32767 :std::numeric_limits< U >::max()))
Volume thresholding.
Definition: threshold.h:159
clip2(LEFT threshold1, LEFT threshold2)
Definition: threshold.h:478
threshold_t _type
Threshold type.
Definition: threshold.h:150
thresh1(LEFT threshold, LEFT background)
Definition: threshold.h:178
virtual ~AimsThreshold()
Definition: threshold.h:109
void setSizeX(float sizex)
virtual bool removeProperty(const std::string &)
TimeTexture< T > operator()(const TimeTexture< T > &sqv)
Return the multi-level thresholded texture.
Definition: threshold.h:589
T _level
Lower level or unique level.
Definition: threshold.h:152
float sizeX() const
size_t nItem() const
Definition: texture.h:147
virtual Header * cloneHeader(bool keepUuid=false) const =0
const T & item(int n) const
Definition: texture.h:149
AimsData< T > clip(const AimsData< T > &sqv)
Return the multi-level thresholded image with clipped values (backgd ignored)
Definition: threshold.h:505
thresh2(LEFT threshold1, LEFT threshold2, LEFT background)
Definition: threshold.h:277
thresh2_bin(LEFT threshold1, LEFT threshold2, RIGHT foreground)
Definition: threshold.h:721
threshold_t _type
Threshold type.
Definition: threshold.h:121
AimsData< U > bin(const AimsData< T > &sqv)
Return the binary thresholded image.
Definition: threshold.h:740
T _level2
Upper level.
Definition: threshold.h:125
clip1(LEFT threshold)
Definition: threshold.h:413
const aims::Header * header() const
The template class to make thresholds.
Definition: threshold.h:94
threshold_t
Definition: threshold.h:50
float sizeY() const
carto::rc_ptr< carto::Volume< T > > volume()
AimsData< T > operator()(const AimsData< T > &sqv)
Return the multi-level thresholded image.
Definition: threshold.h:296
T _level2
Upper level.
Definition: threshold.h:154
virtual ~AimsTexThreshold()
Definition: threshold.h:141
Volume< OUTP > & applyTowards(const Volume< T > &vol, Volume< OUTP > &dst, UnaryFunction func)
int dimT() const
AimsTexThreshold(threshold_t type, T level, T level2=0, T backgd=0)
Texture thresholding.
Definition: threshold.h:166
virtual bool hasProperty(const std::string &) const
thresh1_bin(LEFT threshold, RIGHT foreground)
Definition: threshold.h:702
TimeTexture< U > bin(const TimeTexture< T > &sqv)
Return the binary thresholded texture.
Definition: threshold.h:855
int dimX() const
int borderWidth() const
Usefull offsets for A.I.M.S.
Definition: border.h:200