<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">I don't have that much experience in generic programming, so I got lost easily when I was trying to do this:</div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">I had a template class which has several functions to do filter, registration, write-out, etc. This is how one function looks like in .cxx:</div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">(typedef itk::Image< TPixelType, TImageDimension > ImageType;)</font></div><div><font class="Apple-style-span"
face="'times new roman', 'new york', times, serif"><br></font></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div style="font-size: 12pt; "><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif">template <typename TPixelType, unsigned int TImageDimension> </font></div></div><div><div style="font-size: 12pt; "><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif">typename MyClass <TPixelType,TImageDimension>::ImageType::Pointer MyClass<span class="Apple-style-span"><TPixelType,TImageDimension>::</span></font></div></div><div><div style="font-size: 12pt; "><span class="Apple-style-span"><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif">MyFlipFilter(typename </font></span><span class="Apple-style-span" style="color:
rgb(255, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: medium; ">MyClass<span class="Apple-style-span"><TPixelType,TImageDimension>::ImageType::Pointer InputImage)</span></span></div></div><div style="font-size: 12pt; "><span class="Apple-style-span"><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif">{</font></span></div><div><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif"> typedef itk::FlipImageFilter< ImageType > FlipFilterType;</font></div><div><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif"> ..</font></div><div><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif"> ..</font></div><div><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif"> return
FlipFilter->GetOutput();</font></div><div style="font-size: 12pt; "><font class="Apple-style-span" color="#ff0000" face="'times new roman', 'new york', times, serif">}</font></div></blockquote><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Now I want to template 'ImageType' in the function too, because I may want to flip the displacement vector field which has vector pixel, like</div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space: pre; ">        </span><font class="Apple-style-span" color="#ff0000">typedef typename itk::Image< VectorType, TImageDimension > DeformationFieldType;</font></font></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new york',
times, serif; font-size: 16px; "><br></span></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; ">Obviously just replacing ImageType with TempType and stacking 'template' keyword don't work. I am not confident that I can put all the 'template' 'typename' kewords at the correct places, so </span><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; ">I hope to get some suggestions from you generic experts on how to do this properly? And, am I doing the proper work of building the </span><span class="Apple-style-span" style="color: rgb(255, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; ">MyFlipFilter </span><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; ">function?</span></div><div><span
class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; "><br></span></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; ">Thanks for any response!</span></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; "><br></span></div><div><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; ">Ryan</span></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><font class="Apple-style-span" color="#ff0000"><br></font></font></div><div style="color: black; font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; position: fixed; "></div>
</div></body></html>