[ITK] [ITK-users] Multiply two .img or .hdr images in ITK

Pansam Changmi pansam5green at gmail.com
Sun Apr 27 12:34:11 EDT 2014


Error    27    error C2027: use of undefined type
'itk::Concept::MultiplyOperator'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
98    1    MultiplyImageFilter
Error    1    error C2039: 'PixelType' : is not a member of
'itk::ImageFileReader<TOutputImage>'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
73    1    MultiplyImageFilter
Error    4    error C2039: 'PixelType' : is not a member of
'itk::ImageFileReader<TOutputImage>'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
74    1    MultiplyImageFilter
Error    7    error C2039: 'PixelType' : is not a member of
'itk::ImageFileReader<TOutputImage>'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
75    1    MultiplyImageFilter
Error    13    error C2039: 'PixelType' : is not a member of
'itk::ImageFileReader<TOutputImage>'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
82    1    MultiplyImageFilter
Error    16    error C2039: 'PixelType' : is not a member of
'itk::ImageFileReader<TOutputImage>'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
83    1    MultiplyImageFilter
Error    19    error C2039: 'PixelType' : is not a member of
'itk::ImageFileReader<TOutputImage>'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
84    1    MultiplyImageFilter
Error    24    error C2039: 'PixelType' : is not a member of
'itk::ImageFileReader<TOutputImage>'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
98    1    MultiplyImageFilter
Error    3    error C2065: 'PixelType' : undeclared identifier
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
73    1    MultiplyImageFilter
Error    6    error C2065: 'PixelType' : undeclared identifier
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
74    1    MultiplyImageFilter
Error    9    error C2065: 'PixelType' : undeclared identifier
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
75    1    MultiplyImageFilter
Error    15    error C2065: 'PixelType' : undeclared identifier
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
82    1    MultiplyImageFilter
Error    18    error C2065: 'PixelType' : undeclared identifier
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
83    1    MultiplyImageFilter
Error    21    error C2065: 'PixelType' : undeclared identifier
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
84    1    MultiplyImageFilter
Error    26    error C2065: 'PixelType' : undeclared identifier
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
98    1    MultiplyImageFilter
Error    2    error C2146: syntax error : missing ',' before identifier
'PixelType'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
73    1    MultiplyImageFilter
Error    5    error C2146: syntax error : missing ',' before identifier
'PixelType'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
74    1    MultiplyImageFilter
Error    8    error C2146: syntax error : missing ',' before identifier
'PixelType'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
75    1    MultiplyImageFilter
Error    14    error C2146: syntax error : missing ',' before identifier
'PixelType'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
82    1    MultiplyImageFilter
Error    17    error C2146: syntax error : missing ',' before identifier
'PixelType'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
83    1    MultiplyImageFilter
Error    20    error C2146: syntax error : missing ',' before identifier
'PixelType'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
84    1    MultiplyImageFilter
Error    25    error C2146: syntax error : missing ',' before identifier
'PixelType'
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
98    1    MultiplyImageFilter
Error    28    error C2663:
'itk::BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,TFunction>::SetInput1'
: 3 overloads have no legal conversion for 'this' pointer
D:\Academics\Course\Semester 12\Design of Surgical
Devices\Project\TestProject\MultiplyImageFilter\src\MultiplyImageFilter.cxx
37    1    MultiplyImageFilter
Error    29    error C2663:
'itk::BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,TFunction>::SetInput2'
: 3 overloads have no legal conversion for 'this' pointer
D:\Academics\Course\Semester 12\Design of Surgical
Devices\Project\TestProject\MultiplyImageFilter\src\MultiplyImageFilter.cxx
38    1    MultiplyImageFilter
Error    12    error C2955: 'itk::BinaryFunctorImageFilter' : use of class
template requires template argument list
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
76    1    MultiplyImageFilter
Error    11    error C2955: 'itk::Functor::Mult' : use of class template
requires template argument list
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
75    1    MultiplyImageFilter
Error    23    error C2955: 'itk::Functor::Mult' : use of class template
requires template argument list
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
85    1    MultiplyImageFilter
Error    10    error C3203: 'Mult' : unspecialized class template can't be
used as a template argument for template parameter 'TFunction', expected a
real type
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
75    1    MultiplyImageFilter
Error    22    error C3203: 'Mult' : unspecialized class template can't be
used as a template argument for template parameter 'TFunction', expected a
real type
D:\ITK\src\Modules\Filtering\ImageIntensity\include\itkMultiplyImageFilter.h
85    1    MultiplyImageFilter
    30    IntelliSense: no instance of overloaded function
"itk::ImageFileWriter<TInputImage>::SetInput [with
TInputImage=itk::Image<unsigned char, 3U>]" matches the argument list
            argument types are: (itk::ImageFileReader<itk::Image<unsigned
char, 3U>, itk::DefaultConvertPixelTraits<unsigned char>> *)
            object type is: itk::ImageFileWriter<itk::Image<unsigned char,
3U>>    d:\Academics\Course\Semester 12\Design of Surgical
Devices\Project\TestProject\MultiplyImageFilter\src\MultiplyImageFilter.cxx
43    9    MultiplyImageFilter



On Sun, Apr 27, 2014 at 8:29 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> What are the errors?
>
> On Sun, Apr 27, 2014 at 10:48 AM, Pansam Changmi <pansam5green at gmail.com>
> wrote:
> > Thanks guys. My requirement is kind of just using ITK. It is an
> assignment
> > actually.
> > Can you guys help me out what am I doing wrong here. I have busted my
> head
> > over this for the whole day. I am getting like 30 errors :'(
> >
> > The code:
> >
> >
> > #include "itkImage.h"
> > #include "itkImageFileReader.h"
> > #include "itkImageFileWriter.h"
> > #include "itkRescaleIntensityImageFilter.h"
> > #include "itkMultiplyImageFilter.h"
> >
> > int main( int argc, char * argv[] )
> > {
> >   if( argc < 4 )
> >     {
> >     std::cerr << "Usage: " << argv[0];
> >     std::cerr << " image1  image2 ";
> >
> >     std::cerr << "outputImagefile " << std::endl;
> >     return EXIT_FAILURE;
> >     }
> >
> >   typedef  unsigned char  PixelType;
> >
> >   const   unsigned int        Dimension = 3;
> >   typedef itk::Image< PixelType, Dimension >  Image1Type;
> >   typedef itk::Image< PixelType, Dimension >  Image2Type;
> >
> >   typedef itk::ImageFileReader< Image1Type > Image1ReaderType;
> >   typedef itk::ImageFileReader< Image2Type > Image2ReaderType;
> >
> >
> >   Image1ReaderType::Pointer Image1Reader = Image1ReaderType::New();
> >   Image2ReaderType::Pointer Image2Reader = Image2ReaderType::New();
> >
> >   Image1Reader->SetFileName( argv[1] );
> >   Image2Reader->SetFileName( argv[2] );
> >
> >   typedef itk::MultiplyImageFilter <Image1ReaderType, Image2ReaderType >
> >       MultiplyImageFilterType;
> >
> >   MultiplyImageFilterType::Pointer multiplyFilter =
> > MultiplyImageFilterType::New ();
> >   multiplyFilter->SetInput1(Image1Reader);
> >   multiplyFilter->SetInput2(Image2Reader);
> >
> >   typedef itk::Image< PixelType, Dimension > OutputImageType;
> >   typedef itk::ImageFileWriter< OutputImageType >  WriterType;
> >   WriterType::Pointer      writer =  WriterType::New();
> >   writer->SetFileName( argv[3] );
> >   writer->SetInput( multiplyFilter->GetOutput() );
> >   writer->Update();
> >
> >   return EXIT_SUCCESS;
> > }
> >
> >
> >
> >
> > On Sun, Apr 27, 2014 at 7:00 PM, Bradley Lowekamp <
> blowekamp at mail.nih.gov>
> > wrote:
> >>
> >> Hello,
> >>
> >> You may be interested in the SimpleITK bindings for ITK. SimpleITK
> >> provides an easy to use interface on top of ITK which excels
> facilitation
> >> quick image manipulation with ITK, and enables interactive manipulations
> >> with tools such as IPython[1]
> >>
> >> SimpleITK for python is readily available as a binary download[2].  What
> >> you are looking for can be done in SimpleITK like this:
> >>
> >> import SimpleITK as sitk
> >> img1 = sitk.ReadImage("head.img")
> >> img2 = sitk.ReadImage("BrainMask.img")
> >> out = img1*img2
> >> sitk.WriteImage("out.img")
> >>
> >> This assumes that the two images occupy the same physical space and are
> >> the same pixel type. The binary operators in SimpleITK require that the
> >> pixel types are the same, so a cast may be needed.
> >>
> >> However, if you are multiplying a mask by the grayscale you may be
> >> interested in the MaskImageFilter[3]. This filter will support most
> >> combinations and can be used:
> >>
> >> sitk.Mask(img1, img2).
> >>
> >> Enjoy,
> >> Brad
> >>
> >> [1] http://simpleitk.github.io/SimpleITK-Notebooks/
> >> [2]
> >>
> http://www.itk.org/Wiki/SimpleITK/GettingStarted#Downloading_the_binaries
> >> [3]
> >>
> http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1MaskImageFilter.html
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Apr 27, 2014, at 1:39 AM, Pansam Changmi <pansam5green at gmail.com>
> >> wrote:
> >>
> >> > Hi,
> >> >
> >> > Can anyone tell me how to multiply two .img or .hdr images (for
> example
> >> > head.img and BrainMask.img) in ITK? Do I need VTK? ITK-Snap? C3d tool?
> >> >
> >> > Regards,
> >> > Pansam
> >> > _____________________________________
> >> > Powered by www.kitware.com
> >> >
> >> > Visit other Kitware open-source projects at
> >> > http://www.kitware.com/opensource/opensource.html
> >> >
> >> > Kitware offers ITK Training Courses, for more information visit:
> >> > http://www.kitware.com/products/protraining.php
> >> >
> >> > Please keep messages on-topic and check the ITK FAQ at:
> >> > http://www.itk.org/Wiki/ITK_FAQ
> >> >
> >> > Follow this link to subscribe/unsubscribe:
> >> > http://www.itk.org/mailman/listinfo/insight-users
> >>
> >
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.php
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> >
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20140427/d77d4a54/attachment-0002.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users


More information about the Community mailing list