<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">There were 3 fairly obvious mistakes. Attached are a diff file and a compilable source code.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">HTH,</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Dženan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 19, 2016 at 2:06 PM, Kurt Sansom <span dir="ltr"><<a href="mailto:kayarre@gmail.com" target="_blank">kayarre@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This is one of my first attempts at using the ITK library, using some code from someone elses masters thesis.<div><br></div><div>I am getting the following type errors and and the subsequent code that I am compiling on a mac:</div><div><br></div><div>Thanks so much.</div><div>







<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Core/Common/include/itkImageToImageFilter.h:126:20: </b></span><span><b>error: </b></span><span><b>type 'InputImageType' (aka 'unsigned char') cannot be</b></span></p>
<p><span><b>      used prior to '::' because it has no members</b></span></p>
<p><span>  typedef typename InputImageType::Pointer      InputImagePointer;</span></p>
<p><span><b>                   ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/ImageFilterBase/include/itkBoxImageFilter.h:41:10: note: </b>in instantiation of template class</span></p>
<p><span>      'itk::ImageToImageFilter<unsigned char, itk::Image<unsigned char, 3> >' requested here</span></p>
<p><span>  public ImageToImageFilter< TInputImage, TOutputImage ></span></p>
<p><span><b>         ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/ImageFilterBase/include/itkKernelImageFilter.h:41:10: note: </b>in instantiation of template class</span></p>
<p><span>      'itk::BoxImageFilter<unsigned char, itk::Image<unsigned char, 3> >' requested here</span></p>
<p><span>  public BoxImageFilter< TInputImage, TOutputImage ></span></p>
<p><span><b>         ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h:56:10: note: </b>in</span></p>
<p><span>      instantiation of template class 'itk::KernelImageFilter<unsigned char, itk::Image<unsigned char, 3>, itk::BinaryBallStructuringElement<unsigned char, 3,</span></p>
<p><span>      itk::NeighborhoodAllocator<unsigned char> > >' requested here</span></p>
<p><span>  public KernelImageFilter< TInputImage, TOutputImage, TKernel ></span></p>
<p><span><b>         ^</b></span></p>
<p><span><b>/Users/sansomk/code/cpp/us_seg/morph.cxx:63:3: note: </b>in instantiation of template class 'itk::BinaryMorphologicalOpeningImageFilter<unsigned char,</span></p>
<p><span>      itk::Image<unsigned char, 3>, itk::BinaryBallStructuringElement<unsigned char, 3, itk::NeighborhoodAllocator<unsigned char> > >' requested here</span></p>
<p><span>  FilterType::Pointer filter = FilterType::New();</span></p>
<p><span><b>  ^</b></span></p>
<p><span>In file included from /Users/sansomk/code/cpp/us_seg/morph.cxx:12:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/ImageIntensity/include/itkRescaleIntensityImageFilter.h:21:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Core/Common/include/itkUnaryFunctorImageFilter.h:22:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Core/Common/include/itkInPlaceImageFilter.h:31:</span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Core/Common/include/itkImageToImageFilter.h:127:20: </b></span><span><b>error: </b></span><span><b>type 'InputImageType' (aka 'unsigned char') cannot be</b></span></p>
<p><span><b>      used prior to '::' because it has no members</b></span></p>
<p><span>  typedef typename InputImageType::ConstPointer InputImageConstPointer;</span></p>
<p><span><b>                   ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Core/Common/include/itkImageToImageFilter.h:128:20: </b></span><span><b>error: </b></span><span><b>type 'InputImageType' (aka 'unsigned char') cannot be</b></span></p>
<p><span><b>      used prior to '::' because it has no members</b></span></p>
<p><span>  typedef typename InputImageType::RegionType   InputImageRegionType;</span></p>
<p><span><b>                   ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Core/Common/include/itkImageToImageFilter.h:129:20: </b></span><span><b>error: </b></span><span><b>type 'InputImageType' (aka 'unsigned char') cannot be</b></span></p>
<p><span><b>      used prior to '::' because it has no members</b></span></p>
<p><span>  typedef typename InputImageType::PixelType    InputImagePixelType;</span></p>
<p><span><b>                   ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Core/Common/include/itkImageToImageFilter.h:133:23: </b></span><span><b>error: </b></span><span><b>type 'unsigned char' cannot be used prior to '::'</b></span></p>
<p><span><b>      because it has no members</b></span></p>
<p><span>                      TInputImage::ImageDimension);</span></p>
<p><span><b>                      ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Core/Common/include/itkMacro.h:763:73: note: </b>expanded from macro 'itkStaticConstMacro'</span></p>
<p><span>#  define itkStaticConstMacro(name,type,value) static const type name = value</span></p>
<p><span><b>                                                                        ^</b></span></p>
<p><span>In file included from /Users/sansomk/code/cpp/us_seg/morph.cxx:13:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/MathematicalMorphology/include/itkBinaryBallStructuringElement.h:124:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/MathematicalMorphology/include/itkBinaryBallStructuringElement.hxx:22:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/MathematicalMorphology/include/itkFlatStructuringElement.h:246:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/MathematicalMorphology/include/itkFlatStructuringElement.hxx:40:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/MathematicalMorphology/include/itkVanHerkGilWermanDilateImageFilter.h:21:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/MathematicalMorphology/include/itkVanHerkGilWermanErodeDilateImageFilter.h:21:</span></p>
<p><span>In file included from /Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/ImageFilterBase/include/itkKernelImageFilter.h:21:</span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/ImageFilterBase/include/itkBoxImageFilter.h:59:20: </b></span><span><b>error: </b></span><span><b>type 'unsigned char' cannot be used prior to</b></span></p>
<p><span><b>      '::' because it has no members</b></span></p>
<p><span>  typedef typename TInputImage::RegionType RegionType;</span></p>
<p><span><b>                   ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/ImageFilterBase/include/itkKernelImageFilter.h:41:10: note: </b>in instantiation of template class</span></p>
<p><span>      'itk::BoxImageFilter<unsigned char, itk::Image<unsigned char, 3> >' requested here</span></p>
<p><span>  public BoxImageFilter< TInputImage, TOutputImage ></span></p>
<p><span><b>         ^</b></span></p>
<p><span><b>/Users/sansomk/build/ITK/ITKLatestRelease/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologicalOpeningImageFilter.h:56:10: note: </b>in</span></p>
<p><span>      instantiation of template class 'itk::KernelImageFilter<unsigned char, itk::Image<unsigned char, 3>, itk::BinaryBallStructuringElement<unsigned char, 3,</span></p>
<p><span>      itk::NeighborhoodAllocator<unsigned char> > >' requested here</span></p>
<p><span>  public KernelImageFilter< TInputImage, TOutputImage, TKernel ></span></p>
<p><span><b>         ^</b></span></p>
<p><span><b>/Users/sansomk/code/cpp/us_seg/morph.cxx:63:3: note: </b>in instantiation of template class 'itk::BinaryMorphologicalOpeningImageFilter<unsigned char,</span></p>
<p><span>      itk::Image<unsigned char, 3>, itk::BinaryBallStructuringElement<unsigned char, 3, itk::NeighborhoodAllocator<unsigned char> > >' requested here</span></p>
<p><span>  FilterType::Pointer filter = FilterType::New();</span></p>
<p><span><b>  ^</b></span></p>
<p><span>In file included from /Users/sansomk/code/cpp/us_seg/morph.cxx:13:</span></p>
<p>here is the code:<br></p><p>#if defined(MSCVER)</p><p>  #pragma warning ( disable : 4786 )</p><p>#endif</p><p><br></p><p>#ifdef _BORLANDC_</p><p>  #define ITK_LEAN_AND_MEAN</p><p>#endif</p><p><br></p><p>#include "itkImage.h"</p><p>#include "itkImageFileReader.h"</p><p>#include "itkImageFileWriter.h"</p><p>#include "itkRescaleIntensityImageFilter.h"</p><p>#include "itkBinaryBallStructuringElement.h"</p><p>#include "itkBinaryMorphologicalClosingImageFilter.h"</p><p>#include "itkBinaryMorphologicalOpeningImageFilter.h"</p><p><br></p><p>int main(int argc, char * argv[] ) {</p><p><br></p><p>  if( argc < 5 ) {</p><p>    std::cerr << "Usage: " <<  std::endl;</p><p>    std::cerr << argv [0] << " inputImageFile outputImageFile radiusX(int)"</p><p>      << " radiusY(int) radiusZ(int) " << std::endl;</p><p>    return EXIT_FAILURE;</p><p>  }</p><p>  </p><p>  </p><p>  const unsigned int Dimension = 3;</p><p>  </p><p>  typedef unsigned char InputPixelType;</p><p>  typedef unsigned char OutputPixelType;</p><p>  </p><p>  typedef itk::Image< InputPixelType, Dimension > InputImageType;</p><p>  typedef itk::Image< OutputPixelType, Dimension > OutputImageType;</p><p>  </p><p>  typedef itk::ImageFileReader< InputImageType> ReaderType;</p><p>  typedef itk::ImageFileWriter< OutputImageType> WriterType;</p><p>  </p><p>  typedef itk::BinaryBallStructuringElement< InputPixelType, Dimension > KernelType;</p><p>  </p><p>  typedef itk::BinaryMorphologicalOpeningImageFilter< InputPixelType,</p><p>                                                      OutputImageType,</p><p>                                                      KernelType > FilterType;</p><p>  typedef itk::RescaleIntensityImageFilter<OutputImageType, OutputImageType> RescaleFilterType;</p><p>  </p><p>  </p><p>  // Read Image</p><p>  ReaderType::Pointer reader = ReaderType::New();</p><p>  reader->SetFileName( argv[1] );</p><p>  reader->Update();</p><p>  </p><p>  //Create Kernel (structuring element)</p><p>  KernelType::RadiusType radius;</p><p>  radius[0] = atoi( argv[3] );</p><p>  radius[1] = atoi( argv[4] );</p><p>  radius[2] = atoi( argv[5] );</p><p>  </p><p>  </p><p>  KernelType kernel;</p><p>  kernel.SetRadius( Dimension );</p><p>  kernel.CreateStructuringElement();</p><p>  </p><p>  // Create morphological filter</p><p>  FilterType::Pointer filter = FilterType::New();</p><p>  filter->SetInput( reader );</p><p>  filter->SetKernel( kernel );</p><p>  filter->Update();</p><p>  </p><p>  // Rescale for output</p><p>  RescaleFilterType::Pointer rescaler = RescaleFilterType::New();</p><p>  rescaler->SetOutputMinimum( 0 );</p><p>  rescaler->SetOutputMaximum( 255 );</p><p>  rescaler->SetInput( filter->GetOutput() );</p><p>  //rescaler->Update();</p><p>  </p><p>  // Write output</p><p>  WriterType::Pointer writer = WriterType::New();</p><p>  writer->SetFileName( argv[2] );</p><p>  writer->SetInput( rescaler->GetOutput() );</p><p>  writer->Update();</p><p>  </p><p>  return EXIT_SUCCESS;</p><p><span></span></p><p>}</p><span class="HOEnZb"><font color="#888888"><div><br></div><div><br><div><br clear="all"><div><br></div>-- <br><div>Kurt Sansom<br></div>
</div></div></font></span></div></div>
<br>_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
<br></blockquote></div><br></div>