| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkBloxPixel.txx.html,v $ |
| 5 |
|
Language: C++ |
| 6 |
|
Date: $Date: 2006/01/17 19:15:33 $ |
| 7 |
|
Version: $Revision: 1.4 $ |
| 8 |
|
|
| 9 |
|
Copyright (c) Insight Software Consortium. All rights reserved. |
| 10 |
|
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. |
| 11 |
|
|
| 12 |
|
This software is distributed WITHOUT ANY WARRANTY; without even |
| 13 |
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 |
|
PURPOSE. See the above copyright notices for more information. |
| 15 |
|
|
| 16 |
|
=========================================================================*/ |
| 17 |
|
#ifndef __itkBloxPixel_txx |
| 18 |
|
#define __itkBloxPixel_txx |
| 19 |
|
|
| 20 |
|
#include "itkBloxPixel.h" |
| 21 |
|
|
| 22 |
|
namespace itk |
| 23 |
|
{ |
| 24 |
|
|
| 25 |
|
template <typename TItemType> |
| 26 |
|
BloxPixel<TItemType> |
| 27 |
|
::BloxPixel() |
| 28 |
|
{ |
| 29 |
|
|
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
template <typename TItemType> |
| 33 |
|
BloxPixel<TItemType> |
| 34 |
|
::~BloxPixel() |
| 35 |
|
{ |
| 36 |
|
// We need to clean up memory used by linked list entries |
| 37 |
|
// Walk through all of the elements at the pixel and delete what we find |
| 38 |
|
this->DeleteListEntries(); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
template <typename TItemType> |
| 42 |
|
void |
| 43 |
|
BloxPixel<TItemType> |
| 44 |
|
::DeleteListEntries() |
| 45 |
|
{ |
| 46 |
|
// Delete all entries in the linked list and clear the list |
| 47 |
|
// if the list contains existing entries |
| 48 |
|
if( !( this->empty() ) ) |
| 49 |
|
{ |
| 50 |
|
typename BloxPixel::iterator bpiterator; |
| 51 |
|
|
| 52 |
|
for (bpiterator = this->begin(); bpiterator != this->end(); ++bpiterator) |
| 53 |
|
{ |
| 54 |
|
delete (*bpiterator); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
// Empty the linked list |
| 58 |
|
this->clear(); |
| 59 |
|
} |
| 60 |
|
} |
| 61 |
|
|
| 62 |
|
} // end namespace itk |
| 63 |
|
|
| 64 |
|
#endif |
| 65 |
|
|