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

« back to all changes in this revision

Viewing changes to Code/BasicFilters/itkTriangleMeshToBinaryImageFilter.txx

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-12-19 20:16:49 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081219201649-drt97guwl2ryt0cn

* New upstream version.
  - patches/nifti-versioning.patch: Remove.  Applied upstream.
  - control:
  - rules: Update version numbers, package names.

* control: Build-depend on uuid-dev (gdcm uses it).

* copyright: Update download URL.

* rules: Adhere to parallel=N in DEB_BUILD_OPTIONS by setting MAKEFLAGS.

* compat: Set to 7.
* control: Update build-dep on debhelper to version >= 7.

* CMakeCache.txt.debian: Set CMAKE_BUILD_TYPE to "RELEASE" so that we
  build with -O3 (not -O2), necessary to optimize the templated code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
Program:   Insight Segmentation & Registration Toolkit
4
4
Module:    $RCSfile: itkTriangleMeshToBinaryImageFilter.txx,v $
5
5
Language:  C++
6
 
Date:      $Date: 2008-01-20 18:00:40 $
7
 
Version:   $Revision: 1.10 $
 
6
Date:      $Date: 2008-10-06 14:59:58 $
 
7
Version:   $Revision: 1.11 $
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.
44
44
  m_OutsideValue = NumericTraits<ValueType>::Zero;
45
45
  
46
46
  m_Tolerance = 1e-5;
 
47
  m_InfoImage = NULL; 
47
48
  
48
49
}
49
50
 
170
171
{
171
172
  itkDebugMacro(<< "TriangleMeshToBinaryImageFilter::Update() called");
172
173
 
173
 
  RasterizeTriangles();
 
174
  
174
175
  
175
176
  // Get the input and output pointers 
176
177
  OutputImagePointer   OutputImage = this->GetOutput();
177
 
 
178
 
  if (m_Size[0] == 0 ||  m_Size[1] == 0 ||  m_Size[2] == 0)
179
 
    {
180
 
    itkExceptionMacro(<< "Must Set Image Size");  
181
 
    }
182
 
 
183
 
  typename OutputImageType::RegionType region;
184
 
 
185
 
  region.SetSize ( m_Size );
186
 
  region.SetIndex( m_Index );
187
 
 
188
 
  OutputImage->SetLargestPossibleRegion( region);     // 
189
 
  OutputImage->SetBufferedRegion( region );           // set the region 
190
 
  OutputImage->SetRequestedRegion( region );          //
191
 
  OutputImage->SetSpacing(m_Spacing);         // set spacing
192
 
  OutputImage->SetOrigin(m_Origin);   //   and origin
 
178
  if (m_InfoImage == NULL)
 
179
    {
 
180
    if (m_Size[0] == 0 ||  m_Size[1] == 0 ||  m_Size[2] == 0)
 
181
      {
 
182
      itkExceptionMacro(<< "Must Set Image Size");  
 
183
      }
 
184
 
 
185
    typename OutputImageType::RegionType region;
 
186
    
 
187
    region.SetSize ( m_Size );
 
188
    region.SetIndex( m_Index );
 
189
    
 
190
    OutputImage->SetLargestPossibleRegion( region);     // 
 
191
    OutputImage->SetBufferedRegion( region );           // set the region 
 
192
    OutputImage->SetRequestedRegion( region );          //
 
193
    OutputImage->SetSpacing(m_Spacing);         // set spacing
 
194
    OutputImage->SetOrigin(m_Origin);   //   and origin
 
195
    }
 
196
  else
 
197
    {
 
198
    std::cout << "Using info image" << std::endl;
 
199
    m_InfoImage->Update();
 
200
    OutputImage->CopyInformation(m_InfoImage);
 
201
    OutputImage->SetRegions(m_InfoImage->GetLargestPossibleRegion());
 
202
    m_Size = m_InfoImage->GetLargestPossibleRegion().GetSize();
 
203
    m_Index = m_InfoImage->GetLargestPossibleRegion().GetIndex();
 
204
    m_Spacing = m_InfoImage->GetSpacing();
 
205
    m_Origin = m_InfoImage->GetOrigin();
 
206
    }
193
207
 
194
208
  OutputImage->Allocate();   // allocate the image
195
209
  
 
210
  RasterizeTriangles();
 
211
  
196
212
  typedef itk::ImageRegionIteratorWithIndex<OutputImageType> myIteratorType;
197
213
 
198
 
  myIteratorType it(OutputImage,region);
 
214
  myIteratorType it(OutputImage,OutputImage->GetLargestPossibleRegion());
199
215
 
200
216
  
201
217
  int DataIndex=0;