~ubuntu-branches/ubuntu/precise/insighttoolkit/precise

« back to all changes in this revision

Viewing changes to Utilities/MetaIO/metaTube.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-05-31 12:07:29 UTC
  • mfrom: (3.1.3 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080531120729-7g7layn480le43ko
Tags: 3.6.0-3
* debian/patches/gccxml-workaround.patch: New.  Work around gccxml issue
  with #include_next; c.f. http://www.gccxml.org/Bug/view.php?id=7134.  
* debian/patches/gcc43.patch: include <cstring> in itkNeighbourhood.h.
  This only showed up in the tcl wrapping step.

* Above two entries fix FTBFS for GCC 4.3-based systems.
  Closes: #478500.

* debian/patches/sharedforward.patch: New.  Ensure that linux/sparc
  systems are not also configured as a SUN sparc system, which requires
  SUN header sys/isa_defs.h.  Closes: #478940, #483312.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  Program:   MetaIO
4
4
  Module:    $RCSfile: metaTube.cxx,v $
5
5
  Language:  C++
6
 
  Date:      $Date: 2006/10/27 12:25:53 $
7
 
  Version:   $Revision: 1.29 $
 
6
  Date:      $Date: 2008-04-09 01:44:28 $
 
7
  Version:   $Revision: 1.34 $
8
8
 
9
9
  Copyright (c) Insight Software Consortium. All rights reserved.
10
10
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
14
14
     PURPOSE.  See the above copyright notices for more information.
15
15
 
16
16
=========================================================================*/
 
17
#ifdef _MSC_VER
 
18
#pragma warning(disable:4702)
 
19
#pragma warning(disable:4284)
 
20
#endif
 
21
 
17
22
#include "metaTube.h"
18
23
 
19
24
#include <stdio.h>
24
29
namespace METAIO_NAMESPACE {
25
30
#endif
26
31
 
 
32
TubePnt::
 
33
TubePnt(int dim)
 
34
  {
 
35
  m_Dim = dim;
 
36
  m_X = new float[m_Dim];
 
37
  m_T = new float[m_Dim];
 
38
  m_V1= new float[m_Dim];
 
39
  m_V2= new float[m_Dim];
 
40
  for(unsigned int i=0;i<m_Dim;i++)
 
41
    {
 
42
    m_X[i] = 0;
 
43
    m_V1[i]= 0;
 
44
    m_V2[i]= 0;
 
45
    m_T[i]= 0;
 
46
    }
 
47
  m_R=0;
 
48
  //Color is red by default
 
49
  m_Color[0]=1.0;
 
50
  m_Color[1]=0.0;
 
51
  m_Color[2]=0.0;
 
52
  m_Color[3]=1.0;
 
53
  m_ID = -1;
 
54
  }
 
55
 
 
56
TubePnt::
 
57
~TubePnt()
 
58
  {
 
59
  delete []m_X;
 
60
  delete []m_V1;
 
61
  delete []m_V2;
 
62
  delete []m_T;
 
63
  }
 
64
 
27
65
/** MetaTube Constructors */
28
66
MetaTube::
29
67
MetaTube()
257
295
    m_Fields.push_back(mF);
258
296
    }
259
297
 
260
 
  m_NPoints = m_PointList.size();
 
298
  m_NPoints = (int)m_PointList.size();
261
299
  mF = new MET_FieldRecordType;
262
300
  MET_InitWriteField(mF, "NPoints", MET_INT,m_NPoints);
263
301
  m_Fields.push_back(mF);
477
515
    i=0;
478
516
    int d;
479
517
    unsigned int k;
480
 
    for(j=0; j<m_NPoints; j++) 
 
518
    for(j=0; j<(int)m_NPoints; j++) 
481
519
      {
482
520
      TubePnt* pnt = new TubePnt(m_NDims);
483
521
      
508
546
 
509
547
      for(d = 0; d < m_NDims; d++)
510
548
        {
511
 
        char* num = new char[sizeof(float)];
 
549
        num = new char[sizeof(float)];
512
550
        for(k=0;k<sizeof(float);k++)
513
551
          {
514
552
          num[k] = _data[i+k];
515
553
          }
516
 
        float td = (float)((float*)num)[0];
 
554
        td = (float)((float*)num)[0];
517
555
        MET_SwapByteIfSystemMSB(&td,MET_FLOAT);
518
556
        i+=sizeof(float);
519
557
        pnt->m_V1[d] = (float)td;
524
562
        {
525
563
        for(d = 0; d < m_NDims; d++)
526
564
          {
527
 
          char* num = new char[sizeof(float)];
 
565
          num = new char[sizeof(float)];
528
566
          for(k=0;k<sizeof(float);k++)
529
567
            {
530
568
            num[k] = _data[i+k];
531
569
            }
532
 
          float td = (float)((float*)num)[0];
 
570
          td = (float)((float*)num)[0];
533
571
          MET_SwapByteIfSystemMSB(&td,MET_FLOAT);
534
572
          i+=sizeof(float);
535
573
          pnt->m_V2[d] = (float)td;
539
577
      
540
578
      for(d = 0; d < m_NDims; d++)
541
579
        {
542
 
        char* num = new char[sizeof(float)];
 
580
        num = new char[sizeof(float)];
543
581
        for(k=0;k<sizeof(float);k++)
544
582
          {
545
583
          num[k] = _data[i+k];
546
584
          }
547
 
        float td = (float)((float*)num)[0];
 
585
        td = (float)((float*)num)[0];
548
586
        MET_SwapByteIfSystemMSB(&td,MET_FLOAT);
549
587
        i+=sizeof(float);
550
588
        pnt->m_T[d] = (float)td;
553
591
           
554
592
      for(d=0; d<4; d++)
555
593
        {
556
 
        char* num = new char[sizeof(float)];
 
594
        num = new char[sizeof(float)];
557
595
        for(k=0;k<sizeof(float);k++)
558
596
          {
559
597
          num[k] = _data[i+k];
560
598
          }
561
 
        float td = (float)((float*)num)[0];
 
599
        td = (float)((float*)num)[0];
562
600
        MET_SwapByteIfSystemMSB(&td,MET_FLOAT);
563
601
        i+=sizeof(float);
564
602
        pnt->m_Color[d] = (float)td;
582
620
    }
583
621
  else
584
622
    {
585
 
    for(j=0; j<m_NPoints; j++) 
 
623
    for(j=0; j<(int)m_NPoints; j++) 
586
624
      {
587
625
      if(m_Event)
588
626
        {
712
750
  if(m_BinaryData)
713
751
    {
714
752
    PointListType::const_iterator it = m_PointList.begin();
 
753
    PointListType::const_iterator itEnd = m_PointList.end();
715
754
    int elementSize;
716
755
    MET_SizeOfType(m_ElementType, &elementSize);
717
756
 
718
757
    char* data = new char[(m_NDims*(2+m_NDims)+10)*m_NPoints*elementSize];
719
758
    int i=0;
720
759
    int d;
721
 
    while(it != m_PointList.end())
 
760
    while(it != itEnd)
722
761
      {
723
762
      for(d = 0; d < m_NDims; d++)
724
763
        {
776
815
  else
777
816
    {
778
817
    PointListType::const_iterator it = m_PointList.begin();
 
818
    PointListType::const_iterator itEnd = m_PointList.end();
779
819
  
780
820
    int d;
781
 
    while(it != m_PointList.end())
 
821
    while(it != itEnd)
782
822
      {
783
823
      for(d = 0; d < m_NDims; d++)
784
824
        {