[Insight-users] Cannot display image using ITKVTKGlue

Tanweer Rashid trash001 at odu.edu
Fri Sep 28 17:47:09 EDT 2012


My source code is as follows:

#include <itkImage.h>
#include <itkImageFileReader.h>
#include <itkImageToVTKImageFilter.h>

#include <vtkImageViewer.h>
#include <vtkRenderWindowInteractor.h>

int main(int argc, char **argv) {

typedef itk::Image< unsigned short, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::ImageToVTKImageFilter<ImageType> FilterType;

ReaderType::Pointer reader = ReaderType::New();
FilterType::Pointer connector = FilterType::New();
 reader->SetFileName(argv[1]);
connector->SetInput(reader->GetOutput());

vtkImageViewer *viewer = vtkImageViewer::New();

vtkRenderWindowInteractor *renderWindowInteractor =
vtkRenderWindowInteractor::New();

viewer->SetupInteractor(renderWindowInteractor);
viewer->SetInput(connector->GetOutput());
viewer->SetColorWindow(255);
viewer->SetColorLevel(128);
viewer->Render();

renderWindowInteractor->Start();

return 0;
}


- - - TR


On Fri, Sep 28, 2012 at 5:44 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:

> We have many examples using the glue code, and they are run every night.
>
> Please supply your source code.
>
> Thanks
>
>
> On Fri, Sep 28, 2012 at 5:38 PM, Tanweer Rashid <trash001 at odu.edu> wrote:
>
>> Yes I built my own ITK in debug mode, and with ITKVtkGlue.
>>
>> - - - TR
>>
>>
>> On Fri, Sep 28, 2012 at 3:11 PM, Bill Lorensen <bill.lorensen at gmail.com>wrote:
>>
>>> Please keep replies on the list...
>>>
>>> Did you build your own ITK?
>>>
>>>
>>> On Fri, Sep 28, 2012 at 2:49 PM, Tanweer Rashid <trash001 at odu.edu>wrote:
>>>
>>>> Hi Bill,
>>>> I am using the following for CMakeLists.txt
>>>>
>>>> # Project Client Server
>>>> CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
>>>>
>>>> PROJECT( main)
>>>>
>>>> FIND_PACKAGE ( ITK )
>>>> IF (  ITK_FOUND  )
>>>>          INCLUDE(  ${USE_ITK_FILE}  )
>>>> ENDIF(   ITK_FOUND   )
>>>>
>>>> FIND_PACKAGE ( VTK )
>>>> IF (   VTK_FOUND   )
>>>>          INCLUDE(  ${USE_VTK_FILE}  )
>>>> ENDIF(   VTK_FOUND   )
>>>>
>>>> INCLUDE_DIRECTORIES(${main_SOURCE_DIR})
>>>>
>>>> ADD_EXECUTABLE( main   main.cxx )
>>>>
>>>> TARGET_LINK_LIBRARIES ( main ${ITK_LIBRARIES} ${VTK_LIBRARIES})
>>>>
>>>>
>>>> - - - Tanweer Rashid
>>>>
>>>>
>>>> On Fri, Sep 28, 2012 at 2:33 PM, Bill Lorensen <bill.lorensen at gmail.com
>>>> > wrote:
>>>>
>>>>> What is your CMakeLists.txt file?
>>>>>
>>>>> On Fri, Sep 28, 2012 at 2:10 PM, Tanweer Rashid <trash001 at odu.edu>wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am  trying to read an image with ITK and display it with VTK using
>>>>>> ITKVtkGlue. The program compiles and builds without any errors, but when it
>>>>>> executes, it gives the following message:
>>>>>>
>>>>>> ERROR: In D:\ProgramFiles\VTK-5.10-src\Imaging\vtkImageImport.cxx,
>>>>>> line 337
>>>>>> vtkImageImport (0050B648): Calling UpdateInformationCallback:
>>>>>> d:\programfiles\itk\include\itk-4.2\itkimagefilereader.hxx:143:
>>>>>>  Could not create IO object for file D:\AAA.png
>>>>>>   Tried to create one of the following:
>>>>>>   You probably failed to set a file suffix, or
>>>>>>     set the suffix to an unsupported type.
>>>>>>
>>>>>> I am compiling on VS2010 on Windows 7 (64 bit). My VTK and ITK
>>>>>> libraries and my program are all compiled in 32 bit.
>>>>>>
>>>>>> Thanks,
>>>>>> --
>>>>>> Tanweer Rashid
>>>>>> MSVE Dept.
>>>>>> Old Dominion University
>>>>>>
>>>>>>
>>>>>> _____________________________________
>>>>>> 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
>>>>>
>>>>>  ------------------------------
>>>>>
>>>>> Spam<https://www.spamtrap.odu.edu/b.php?i=705587510&m=617a3d71874b&t=20120928&c=s>
>>>>> Not spam<https://www.spamtrap.odu.edu/b.php?i=705587510&m=617a3d71874b&t=20120928&c=n>
>>>>> Forget previous vote<https://www.spamtrap.odu.edu/b.php?i=705587510&m=617a3d71874b&t=20120928&c=f>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Tanweer Rashid
>>>> MSVE Dept.
>>>> Old Dominion University
>>>>
>>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>>
>>>  ------------------------------
>>>
>>> Spam<https://www.spamtrap.odu.edu/b.php?i=705598249&m=6ac5b7bc94c1&t=20120928&c=s>
>>> Not spam<https://www.spamtrap.odu.edu/b.php?i=705598249&m=6ac5b7bc94c1&t=20120928&c=n>
>>> Forget previous vote<https://www.spamtrap.odu.edu/b.php?i=705598249&m=6ac5b7bc94c1&t=20120928&c=f>
>>>
>>
>>
>>
>> --
>> Tanweer Rashid
>> MSVE Dept.
>> Old Dominion University
>>
>>
>> _____________________________________
>> 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
>
>  ------------------------------
>
> Spam<https://www.spamtrap.odu.edu/b.php?i=705642465&m=ea52a89c641f&t=20120928&c=s>
> Not spam<https://www.spamtrap.odu.edu/b.php?i=705642465&m=ea52a89c641f&t=20120928&c=n>
> Forget previous vote<https://www.spamtrap.odu.edu/b.php?i=705642465&m=ea52a89c641f&t=20120928&c=f>
>



-- 
Tanweer Rashid
MSVE Dept.
Old Dominion University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120928/6888fb91/attachment.htm>


More information about the Insight-users mailing list