Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > d5e74628f0e673bb8680aebce32b2c04 > files > 16079

itk-doc-3.12.0-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta name="robots" content="noindex">
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>ITK: itkImageIORegion.h Source File</title>
<link href="DoxygenStyle.css" rel="stylesheet" type="text/css">
</head><body bgcolor="#ffffff">


<!--  Section customized for INSIGHT : Tue Jul 17 01:02:45 2001 -->
<center>
<a href="index.html" class="qindex">Main Page</a>&nbsp;&nbsp; 
<a href="modules.html" class="qindex">Groups</a>&nbsp;&nbsp;
<a href="namespaces.html" class="qindex">Namespace List</a>&nbsp;&nbsp;
<a href="hierarchy.html" class="qindex">Class Hierarchy</a>&nbsp;&nbsp;
<a href="classes.html" class="qindex">Alphabetical List</a>&nbsp;&nbsp;
<a href="annotated.html" class="qindex">Compound List</a>&nbsp;&nbsp; 
<a href="files.html" class="qindex">File
List</a>&nbsp;&nbsp; 
<a href="namespacemembers.html" class="qindex">Namespace Members</a>&nbsp;&nbsp; 
<a href="functions.html" class="qindex">Compound Members</a>&nbsp;&nbsp; 
<a href="globals.html" class="qindex">File Members</a>&nbsp;&nbsp;
<a href="pages.html" class="qindex">Concepts</a></center>


<!-- Generated by Doxygen 1.5.9 -->
  <div class="navpath"><a class="el" href="dir_02e23d841c198393a6e961e9a0678fff.html">Code</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_1ee1ddeef2dd172ba0b5030f5ec71db5.html">IO</a>
  </div>
<div class="contents">
<h1>itkImageIORegion.h</h1><a href="itkImageIORegion_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*=========================================================================</span>
<a name="l00002"></a>00002 <span class="comment"></span>
<a name="l00003"></a>00003 <span class="comment">  Program:   Insight Segmentation &amp; Registration Toolkit</span>
<a name="l00004"></a>00004 <span class="comment">  Module:    $RCSfile: itkImageIORegion.h,v $</span>
<a name="l00005"></a>00005 <span class="comment">  Language:  C++</span>
<a name="l00006"></a>00006 <span class="comment">  Date:      $Date: 2009-02-24 15:36:27 $</span>
<a name="l00007"></a>00007 <span class="comment">  Version:   $Revision: 1.23 $</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">  Copyright (c) Insight Software Consortium. All rights reserved.</span>
<a name="l00010"></a>00010 <span class="comment">  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.</span>
<a name="l00011"></a>00011 <span class="comment"></span>
<a name="l00012"></a>00012 <span class="comment">     This software is distributed WITHOUT ANY WARRANTY; without even </span>
<a name="l00013"></a>00013 <span class="comment">     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR </span>
<a name="l00014"></a>00014 <span class="comment">     PURPOSE.  See the above copyright notices for more information.</span>
<a name="l00015"></a>00015 <span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment">=========================================================================*/</span>
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef __itkImageIORegion_h</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkImageIORegion_h</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="itkRegion_8h.html">itkRegion.h</a>"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="itkObjectFactory_8h.html">itkObjectFactory.h</a>"</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="itkImageRegion_8h.html">itkImageRegion.h</a>"</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="itkIndex_8h.html">itkIndex.h</a>"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="itkSize_8h.html">itkSize.h</a>"</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">namespace </span>itk
<a name="l00028"></a>00028 {
<a name="l00029"></a>00029 
<a name="l00053"></a><a class="code" href="classitk_1_1ImageIORegion.html">00053</a> <span class="keyword">class </span><a class="code" href="itkWin32Header_8h.html#7d4384322557205d75f0719c012dded6">ITK_EXPORT</a> <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a>: <span class="keyword">public</span> <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Region</a>
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 <span class="keyword">public</span>:
<a name="l00057"></a><a class="code" href="classitk_1_1ImageIORegion.html#2b9ee3eda6013fc0f4ed3b6700a77011">00057</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a> <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Self</a>;
<a name="l00058"></a><a class="code" href="classitk_1_1ImageIORegion.html#bc320704247d490c393cf25a81790316">00058</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Region</a>        <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Superclass</a>;
<a name="l00059"></a>00059 
<a name="l00061"></a><a class="code" href="classitk_1_1ImageIORegion.html#eeb3dc68db31a8cfd9897d3563d1ef89">00061</a>   <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>           SizeValueType;
<a name="l00062"></a><a class="code" href="classitk_1_1ImageIORegion.html#96cc476349c99c5779674d00599001b7">00062</a>   <span class="keyword">typedef</span> <span class="keywordtype">long</span>                    IndexValueType;
<a name="l00063"></a>00063 
<a name="l00064"></a>00064 
<a name="l00066"></a><a class="code" href="classitk_1_1ImageIORegion.html#8c8071ffb840eee293affb4cb77940f7">00066</a>   <span class="keyword">typedef</span> std::vector&lt;IndexValueType&gt;  <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a>;
<a name="l00067"></a>00067 
<a name="l00069"></a><a class="code" href="classitk_1_1ImageIORegion.html#7d551ab44e81246904ce3942b6fe3939">00069</a>   <span class="keyword">typedef</span> std::vector&lt;SizeValueType&gt;   <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">SizeType</a>;
<a name="l00070"></a>00070 
<a name="l00072"></a><a class="code" href="classitk_1_1ImageIORegion.html#d90cd3443f7e4329a681b421fa4139c9">00072</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1Region.html#f027489f949ced73ad3afe119ca64239">Superclass::RegionType</a>       <a class="code" href="classitk_1_1Region.html#f027489f949ced73ad3afe119ca64239">RegionType</a>;
<a name="l00073"></a>00073 
<a name="l00075"></a>00075   <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a>, <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Region</a>);
<a name="l00076"></a>00076 
<a name="l00078"></a>00078   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structitk_1_1GetImageDimension.html">GetImageDimension</a>() <span class="keyword">const</span>;
<a name="l00079"></a>00079 
<a name="l00083"></a>00083   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetRegionDimension() <span class="keyword">const</span>;
<a name="l00084"></a>00084 
<a name="l00086"></a>00086   <span class="keyword">virtual</span> <a class="code" href="classitk_1_1Region.html#f027489f949ced73ad3afe119ca64239">RegionType</a> GetRegionType() <span class="keyword">const</span>;
<a name="l00087"></a>00087 
<a name="l00090"></a>00090   <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dimension);
<a name="l00091"></a>00091 
<a name="l00094"></a>00094   <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a>();
<a name="l00095"></a>00095 
<a name="l00098"></a>00098   <span class="keyword">virtual</span> ~<a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a>();
<a name="l00099"></a>00099 
<a name="l00102"></a>00102   <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Self</a>&amp; region);
<a name="l00103"></a>00103 
<a name="l00106"></a>00106   <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Self</a>&amp; region);
<a name="l00107"></a>00107 
<a name="l00109"></a>00109   <span class="keywordtype">void</span> SetIndex(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> &amp;index);
<a name="l00110"></a>00110 
<a name="l00112"></a>00112   <span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> &amp; GetIndex() <span class="keyword">const</span>;
<a name="l00113"></a>00113 
<a name="l00116"></a>00116   <span class="keywordtype">void</span> SetSize(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">SizeType</a> &amp;size);
<a name="l00117"></a>00117 
<a name="l00119"></a>00119   <span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">SizeType</a> &amp; GetSize() <span class="keyword">const</span>;
<a name="l00120"></a>00120 
<a name="l00124"></a>00124   SizeValueType GetSize(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> i) <span class="keyword">const</span>;
<a name="l00125"></a>00125   IndexValueType GetIndex(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> i) <span class="keyword">const</span>;
<a name="l00126"></a>00126   <span class="keywordtype">void</span> SetSize(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> i, SizeValueType size);
<a name="l00127"></a>00127   <span class="keywordtype">void</span> SetIndex(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> i, IndexValueType idx);
<a name="l00129"></a>00129 
<a name="l00131"></a>00131   <span class="keywordtype">bool</span> <a class="code" href="namespaceitk.html#e1c1b02c301187419478f5126c789a01">operator==</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Self</a> &amp;region) <span class="keyword">const</span>;
<a name="l00132"></a>00132 
<a name="l00134"></a>00134   <span class="keywordtype">bool</span> <a class="code" href="namespaceitk_1_1ImageToImageFilterDetail.html#7bf30438b5d3bdc0eddbecd9b17baa3b">operator!=</a>(<span class="keyword">const</span> <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Self</a> &amp;region) <span class="keyword">const</span>;
<a name="l00135"></a>00135 
<a name="l00137"></a>00137   <span class="keywordtype">bool</span> IsInside(<span class="keyword">const</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a> &amp;index) <span class="keyword">const</span>;
<a name="l00138"></a>00138 
<a name="l00140"></a>00140   <span class="keywordtype">bool</span> IsInside(<span class="keyword">const</span> <a class="code" href="classitk_1_1Region.html" title="A region represents some portion or piece of data.">Self</a> &amp;region) <span class="keyword">const</span>;
<a name="l00141"></a>00141 
<a name="l00142"></a>00142 
<a name="l00143"></a>00143 <span class="keyword">protected</span>:
<a name="l00148"></a>00148   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="namespaceHardConnectedComponentImageFilter.html#920ae03048a5ad715d803ca2e92b52de">PrintSelf</a>(std::ostream&amp; os, <a class="code" href="classitk_1_1Indent.html" title="Control indentation during Print() invocation.">Indent</a> indent) <span class="keyword">const</span>;
<a name="l00149"></a>00149 
<a name="l00150"></a>00150 <span class="keyword">private</span>:
<a name="l00151"></a>00151   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>      m_ImageDimension;
<a name="l00152"></a>00152   <a class="code" href="namespaceHardConnectedComponentImageFilter.html#be32dc19e71d40322ad9828b9ab40853">IndexType</a>         m_Index;
<a name="l00153"></a>00153   <a class="code" href="namespaceHardConnectedComponentImageFilter.html#5bf82236e1e50e653de84c8ead448599">SizeType</a>          m_Size;
<a name="l00154"></a>00154 };
<a name="l00155"></a>00155 
<a name="l00156"></a>00156 
<a name="l00157"></a>00157 <span class="comment">// Declare operator&lt;&lt;</span>
<a name="l00158"></a>00158 <span class="keyword">extern</span> std::ostream &amp; <a class="code" href="namespaceitk.html#1a9c40969bca6a50e9d688a35d3c4984">operator&lt;&lt;</a>(std::ostream &amp;os, <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a> &amp;region); 
<a name="l00159"></a>00159 
<a name="l00164"></a>00164 <span class="keyword">template</span>&lt; <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VDimension &gt;
<a name="l00165"></a><a class="code" href="classitk_1_1ImageIORegionAdaptor.html">00165</a> <span class="keyword">class </span><a class="code" href="classitk_1_1ImageIORegionAdaptor.html" title="Helper class for converting ImageRegions into ImageIORegions and back.">ImageIORegionAdaptor</a>
<a name="l00166"></a>00166 {
<a name="l00167"></a>00167 <span class="keyword">public</span>:
<a name="l00168"></a><a class="code" href="classitk_1_1ImageIORegionAdaptor.html#4639bf076bc40a7c7b9e5e9bf0e24ac9">00168</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageRegion.html" title="An image region represents a structured region of data.">ImageRegion&lt;VDimension&gt;</a>  <a class="code" href="classitk_1_1ImageRegion.html" title="An image region represents a structured region of data.">ImageRegionType</a>;
<a name="l00169"></a><a class="code" href="classitk_1_1ImageIORegionAdaptor.html#1942af1402adc97e3cbdaa746c9c71cc">00169</a>   <span class="keyword">typedef</span> <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegion</a>            <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegionType</a>;
<a name="l00170"></a>00170 
<a name="l00171"></a><a class="code" href="classitk_1_1ImageIORegionAdaptor.html#a36a1d5ac3d20b641e8ca407670bc5a9">00171</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1Size.html">ImageRegionType::SizeType</a>  <a class="code" href="classitk_1_1Size.html">ImageSizeType</a>;
<a name="l00172"></a><a class="code" href="classitk_1_1ImageIORegionAdaptor.html#68091f3738c88260f850ee5168432293">00172</a>   <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="classitk_1_1Index.html">ImageRegionType::IndexType</a> <a class="code" href="classitk_1_1Index.html">ImageIndexType</a>;
<a name="l00173"></a>00173 
<a name="l00174"></a>00174   <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#b01b38856963bfbf95acf4e8aa9c417f">itkLegacyMacro</a>(<span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">Convert</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageRegion.html" title="An image region represents a structured region of data.">ImageRegionType</a> &amp; outImageRegion, <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegionType</a> &amp; inIORegion) );
<a name="l00175"></a>00175 
<a name="l00176"></a><a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">00176</a>   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">Convert</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageRegion.html" title="An image region represents a structured region of data.">ImageRegionType</a> &amp; inImageRegion, <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegionType</a> &amp; outIORegion, <span class="keyword">const</span> <a class="code" href="classitk_1_1Index.html">ImageIndexType</a> &amp;largestRegionIndex)
<a name="l00177"></a>00177     {
<a name="l00178"></a>00178     <span class="comment">//</span>
<a name="l00179"></a>00179     <span class="comment">// The ImageRegion and ImageIORegion objects may have different dimensions.</span>
<a name="l00180"></a>00180     <span class="comment">// Here we only copy the common dimensions between the two. If the ImageRegion</span>
<a name="l00181"></a>00181     <span class="comment">// has more dimensions than the ImageIORegion, then the defaults of the ImageRegion</span>
<a name="l00182"></a>00182     <span class="comment">// will take care of the remaining codimension. If the ImageRegion has less dimensions</span>
<a name="l00183"></a>00183     <span class="comment">// than the ImageIORegion, then the remaining IO dimensions are simply ignored.</span>
<a name="l00184"></a>00184     <span class="comment">//</span>
<a name="l00185"></a>00185     <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ioDimension = outIORegion.<a class="code" href="classitk_1_1ImageIORegion.html#77efcd54557d996ccbe430611f832a1a">GetImageDimension</a>();
<a name="l00186"></a>00186     <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> imageDimension = VDimension;
<a name="l00187"></a>00187 
<a name="l00188"></a>00188     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> minDimension = ( ioDimension &gt; imageDimension ) ? imageDimension : ioDimension;
<a name="l00189"></a>00189 
<a name="l00190"></a>00190     <a class="code" href="classitk_1_1Size.html">ImageSizeType</a>  size  = inImageRegion.<a class="code" href="classitk_1_1ImageRegion.html#13a537aaa496a4994491d91312b29079">GetSize</a>();
<a name="l00191"></a>00191     <a class="code" href="classitk_1_1Index.html">ImageIndexType</a> index = inImageRegion.<a class="code" href="classitk_1_1ImageRegion.html#47e246964e5d88a51d956099c8fe1dc0">GetIndex</a>();
<a name="l00192"></a>00192     
<a name="l00193"></a>00193     <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; minDimension; i++ )
<a name="l00194"></a>00194       {
<a name="l00195"></a>00195       outIORegion.<a class="code" href="classitk_1_1ImageIORegion.html#c12d56c8e90cb1310d1cd0373cf6e997">SetSize</a>(  i, size[i] );
<a name="l00196"></a>00196       outIORegion.<a class="code" href="classitk_1_1ImageIORegion.html#6265308a3fb540e83003d3e1d87ca2a2">SetIndex</a>( i, index[i] - largestRegionIndex[i]);
<a name="l00197"></a>00197       }
<a name="l00198"></a>00198 
<a name="l00199"></a>00199     <span class="comment">//</span>
<a name="l00200"></a>00200     <span class="comment">// Fill in the remaining codimension (if any) with default values</span>
<a name="l00201"></a>00201     <span class="comment">//</span>
<a name="l00202"></a>00202     <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> k = minDimension; k &lt; ioDimension; k++ )
<a name="l00203"></a>00203       {
<a name="l00204"></a>00204       outIORegion.<a class="code" href="classitk_1_1ImageIORegion.html#c12d56c8e90cb1310d1cd0373cf6e997">SetSize</a>(  k, 1 ); <span class="comment">// Note that default size in IO is 1 not 0</span>
<a name="l00205"></a>00205       outIORegion.<a class="code" href="classitk_1_1ImageIORegion.html#6265308a3fb540e83003d3e1d87ca2a2">SetIndex</a>( k, 0 );
<a name="l00206"></a>00206       }
<a name="l00207"></a>00207     }
<a name="l00208"></a>00208 
<a name="l00209"></a>00209   <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#b01b38856963bfbf95acf4e8aa9c417f">itkLegacyMacro</a>(<span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">Convert</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#1942af1402adc97e3cbdaa746c9c71cc">ImageIORegionType</a> &amp; inIORegion, <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#4639bf076bc40a7c7b9e5e9bf0e24ac9">ImageRegionType</a> &amp; outImageRegion) );
<a name="l00210"></a>00210   
<a name="l00211"></a>00211 
<a name="l00212"></a><a class="code" href="classitk_1_1ImageIORegionAdaptor.html#764d80b5cf0f982438eb4a5f330eaef7">00212</a>   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">Convert</a>( <span class="keyword">const</span> <a class="code" href="classitk_1_1ImageIORegion.html" title="An ImageIORegion represents a structured region of data.">ImageIORegionType</a> &amp; inIORegion, <a class="code" href="classitk_1_1ImageRegion.html" title="An image region represents a structured region of data.">ImageRegionType</a> &amp; outImageRegion, <span class="keyword">const</span> <a class="code" href="classitk_1_1Index.html">ImageIndexType</a> &amp;largestRegionIndex )
<a name="l00213"></a>00213     {
<a name="l00214"></a>00214     <a class="code" href="classitk_1_1Size.html">ImageSizeType</a>  size;
<a name="l00215"></a>00215     <a class="code" href="classitk_1_1Index.html">ImageIndexType</a> index;
<a name="l00216"></a>00216 
<a name="l00217"></a>00217     size.<a class="code" href="classitk_1_1Size.html#7a81d513733bd5cdeaecc2c132541c76">Fill</a>(1);  <span class="comment">// initialize with default values</span>
<a name="l00218"></a>00218     index.<a class="code" href="classitk_1_1Index.html#699b209e56b2a7b5005cd1b3530cce5a">Fill</a>(0);
<a name="l00219"></a>00219 
<a name="l00220"></a>00220     <span class="comment">//</span>
<a name="l00221"></a>00221     <span class="comment">// The ImageRegion and ImageIORegion objects may have different dimensions.</span>
<a name="l00222"></a>00222     <span class="comment">// Here we only copy the common dimensions between the two. If the ImageRegion</span>
<a name="l00223"></a>00223     <span class="comment">// has more dimensions than the ImageIORegion, then the defaults of the ImageRegion</span>
<a name="l00224"></a>00224     <span class="comment">// will take care of the remaining codimension. If the ImageRegion has less dimensions</span>
<a name="l00225"></a>00225     <span class="comment">// than the ImageIORegion, then the remaining IO dimensions are simply ignored.</span>
<a name="l00226"></a>00226     <span class="comment">//</span>
<a name="l00227"></a>00227     <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ioDimension = inIORegion.<a class="code" href="classitk_1_1ImageIORegion.html#77efcd54557d996ccbe430611f832a1a">GetImageDimension</a>();
<a name="l00228"></a>00228     <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> imageDimension = VDimension;
<a name="l00229"></a>00229 
<a name="l00230"></a>00230     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> minDimension = ( ioDimension &gt; imageDimension ) ? imageDimension : ioDimension;
<a name="l00231"></a>00231 
<a name="l00232"></a>00232     <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i&lt;minDimension; i++)
<a name="l00233"></a>00233       {
<a name="l00234"></a>00234       size[i]  = inIORegion.<a class="code" href="classitk_1_1ImageIORegion.html#8395f6ca765e1d9c8cf3cde614804d38">GetSize</a>(i);
<a name="l00235"></a>00235       index[i] = inIORegion.<a class="code" href="classitk_1_1ImageIORegion.html#c058f7b2b5088918dc7599b047df1518">GetIndex</a>(i) + largestRegionIndex[i];
<a name="l00236"></a>00236       }
<a name="l00237"></a>00237 
<a name="l00238"></a>00238     outImageRegion.<a class="code" href="classitk_1_1ImageRegion.html#5c86511415de7c7d1cd9cdce03ea0ead">SetSize</a>( size );
<a name="l00239"></a>00239     outImageRegion.<a class="code" href="classitk_1_1ImageRegion.html#784c2bdce5a9a5a4299f051b75a28996">SetIndex</a>( index );
<a name="l00240"></a>00240     }
<a name="l00241"></a>00241 };
<a name="l00242"></a>00242 
<a name="l00243"></a>00243 <span class="preprocessor">#if !defined(ITK_LEGACY_REMOVE)</span>
<a name="l00244"></a>00244 <span class="preprocessor"></span><span class="keyword">template</span>&lt; <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VDimension &gt;
<a name="l00245"></a>00245 <span class="keywordtype">void</span> <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">ImageIORegionAdaptor&lt;VDimension&gt;::Convert</a>( <span class="keyword">const</span> ImageRegionType &amp; inImageRegion, ImageIORegionType &amp; outIORegion ) 
<a name="l00246"></a>00246 {
<a name="l00247"></a>00247   <a class="code" href="itkMacro_8h.html#d2cd16f412c29e1991932db01111cce7">itkGenericLegacyBodyMacro</a>(<a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">ImageIORegionAdaptor::Convert</a>, 4.0);
<a name="l00248"></a>00248   <span class="comment">// the index argument is required</span>
<a name="l00249"></a>00249   <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#68091f3738c88260f850ee5168432293">ImageIndexType</a> index;
<a name="l00250"></a>00250   index.<a class="code" href="classitk_1_1Index.html#699b209e56b2a7b5005cd1b3530cce5a">Fill</a>(0);
<a name="l00251"></a>00251   <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">ImageIORegionAdaptor&lt;VDimension&gt;::Convert</a>(inImageRegion, outIORegion, index);
<a name="l00252"></a>00252 }
<a name="l00253"></a>00253 
<a name="l00254"></a>00254 <span class="keyword">template</span>&lt; <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> VDimension &gt;
<a name="l00255"></a>00255 <span class="keywordtype">void</span> <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">ImageIORegionAdaptor&lt;VDimension&gt;::Convert</a>( <span class="keyword">const</span> ImageIORegionType &amp; inIORegion, ImageRegionType &amp; outImageRegion )
<a name="l00256"></a>00256 {
<a name="l00257"></a>00257   <a class="code" href="itkMacro_8h.html#d2cd16f412c29e1991932db01111cce7">itkGenericLegacyBodyMacro</a>(<a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">ImageIORegionAdaptor::Convert</a>, 4.0);
<a name="l00258"></a>00258   <span class="comment">// the index argument is required</span>
<a name="l00259"></a>00259   <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#68091f3738c88260f850ee5168432293">ImageIndexType</a> index;
<a name="l00260"></a>00260   index.<a class="code" href="classitk_1_1Index.html#699b209e56b2a7b5005cd1b3530cce5a">Fill</a>(0);
<a name="l00261"></a>00261   <a class="code" href="classitk_1_1ImageIORegionAdaptor.html#5d972ce960f6ae5f58b3f3ff09b105b4">ImageIORegionAdaptor&lt;VDimension&gt;::Convert</a>(inIORegion, outImageRegion, index);
<a name="l00262"></a>00262 }
<a name="l00263"></a>00263 <span class="preprocessor">#endif</span>
<a name="l00264"></a>00264 <span class="preprocessor"></span>
<a name="l00265"></a>00265 } <span class="comment">// end namespace itk</span>
<a name="l00266"></a>00266 
<a name="l00267"></a>00267 <span class="preprocessor">#endif</span>
<a name="l00268"></a>00268 <span class="preprocessor"></span>
</pre></div></div>
<hr><address><small>
Generated at Thu May 7 23:02:07 2009 for ITK  by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img 
src="http://www.stack.nl/~dimitri/doxygen/doxygen.png" alt="doxygen"
align="middle" border=0 width=110 height=53>
</a> 1.5.9 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
 &copy;&nbsp;1997-2000</small></address>
</body>
</html>