[Insight-users] Reusing filters

somesh somesh.bbt at gmail.com
Tue Jun 11 15:57:31 EDT 2013


Hi Group,
I have a very basic doubt regarding re-using filter. I have an application
where:

a) I read an image from file

b) Connect it to vtk for displaying (using itkImageToVTKImageFilter.h , I
use VTKImageViewer2
for displaying the image)

c) Call various filter on the input itk image and the display is updated
automatically.
These filters can be called multiple times. All the filters are wrapped in
a library.

For example, the input image can be a segmentation, which I connect to vtk
for displaying. And I can apply filters like dilation/connected components
etc
on the itk segmentation image and display is updated.

See attached TestITKFilters.cxx. That's a very basic version of what I am
doing in
the application. ReadImage/WriteImage/PasteImage are the "filters".

Here are my doubts:
a) Should I call DisconnectPipeline at lines 32/57/58 if I want to use the
filters
   multiple times.

b) If I call DisconnectPipeline on input image inside the function, does it
also disconnect
 itkImageToVTKImageFilter pipeline ?

c) In the attached code, if I call WriteImage multiple times ( e.g.
uncomment line 87,
the program segfaults with the error:

*terminate called after throwing an instance of
'itk::ImageFileWriterException'*
*  what():  /usr/local/include/ITK-4.3/itkImageFileWriter.hxx:403:*
*Did not get requested region!*
*Requested:*
*ImageRegion (0xbfb788b0)*
*  Dimension: 2*
*  Index: [0, 0]*
*  Size: [640, 400]*
*Actual:*
*ImageRegion (0xbfb788c4)*
*  Dimension: 2*
*  Index: [0, 0]*
*  Size: [0, 0]*

I tried adding
inputImage->SetRequestedRegion(inputImage->GetLargestPossibleRegion());,
but it has no effect.



Thanks,
Somesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130611/824aa3a3/attachment.htm>
-------------- next part --------------
# This is the root ITK CMakeLists file.
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
IF(COMMAND CMAKE_POLICY)
  CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)

# This project is designed to be built outside the Insight source tree.
PROJECT(TestITKFilters)

# Find ITK.
FIND_PACKAGE(ITK REQUIRED)
INCLUDE(${ITK_USE_FILE})

ADD_EXECUTABLE(TestITKFilters TestITKFilters.cxx )

TARGET_LINK_LIBRARIES(TestITKFilters  ${ITK_LIBRARIES})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.png
Type: image/png
Size: 5116 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130611/824aa3a3/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestITKFilters.cxx
Type: application/octet-stream
Size: 2725 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130611/824aa3a3/attachment.obj>


More information about the Insight-users mailing list