[Insight-users] need help with VTKImageExport - more information
Karthik Krishnan
Karthik.Krishnan at kitware.com
Fri Jul 15 11:03:27 EDT 2005
Richard Beare wrote:
>Thanks very much - I had seen the reference to
>itkImageToVTKImageFilter when I did a search of mailing lists, but
>failed to find it because I was looking in the main distribution,
>rather than the Applications hierarchy.
>
>Thanks also for the hint about printing. I was curious about the best
>ways to debug pipelines.
>
>I have another question which you may be able to shed some light on. I
>have worked in image analysis for a number of years and recently moved
>to a medical imaging group, which has prompted me to look into itk.
>One thing that I'm confused about is the apparent lack of any tools to
>query what is actually available in an image file. I'm assuming that
>this capability is there somewhere and that I've missed it. The
>previous toolkits I've used generally had an anonymous image object
>returned by file loading functions which could then be queried to
>determine the pixel type(s) and dimensionality of the image. I was
>wondering how to do the equivalent in ITK. The examples I've seen so
>far require that the user knows what is in the file so that a sensible
>output type can be defined.
>
>
>
Yes. This is one of the problems with generic programming.. There are
two solutions.
1. Make your entire application generic. Lets call it class Application<
PixelType >. This is templated over the pixel type.
Now in you main() function, you will instantiate all pixel types. as in
int main(){
Application< unsigned char > appA;
Application< float > appB;
...
switch( pixelTypeILike )
{
case UNSIGNED_CHAR:
appA->Update();
case FLOAT:
appB->Update();
....
}
2. The readers in ITK are capable of reading despite instantiating them
over the wrong pixel type (with possible loss of precision).
For instance the InsightApplications/ImageViewer reads all kinds of
images. It is explicitly instantiated over float. Effectively, it casts
any input data to float. You could leverage that to run your entire
application on float data. Of course you are wasting memory if the
actual data is unsigned char.......
>Thanks
>
>On 7/13/05, Karthik Krishnan <Karthik.Krishnan at kitware.com> wrote:
>
>
>>A print on the object right before the update could have told you that
>>you were note setting the callbackUserData.
>>
>>volumeData->SetCallbackUserData( thisBridge->GetCallbackUserData() );
>>
>>You can omit some of the other callbacks if you like, but not this.
>>
>>BTW, youa re taking too much trouble. There is a filter that does this
>>for you: InsightApplications/Auxillary/vtk/itkImageToVTKImageFilter you
>>have to copy the filter to your source folder, if you want to use it.
>>
>>HTH
>>kk
>>On Wed, 2005-07-13 at 11:16 +1000, Richard Beare wrote:
>>
>>
>>>Hi,
>>>In my previous message I forgot to include the debugger trace produced
>>>by the crash and that I'm using analyze format images:
>>>
>>>(gdb) where
>>>#0 0x0000002a97526c14 in
>>>itk::VTKImageExportBase::PipelineModifiedCallbackFunction () from
>>>/home/richardb/local/lib/InsightToolkit/libITKBasicFilters.so
>>>#1 0x0000002a95ea80b4 in vtkImageImport::InvokeUpdateInformationCallbacks ()
>>> from /home/richardb/local/lib/vtk/libvtkImaging.so
>>>#2 0x0000002a95ea7b31 in vtkImageImport::UpdateInformation ()
>>> from /home/richardb/local/lib/vtk/libvtkImaging.so
>>>#3 0x0000002a963e75cf in vtkDataObject::UpdateInformation ()
>>> from /home/richardb/local/lib/vtk/libvtkCommon.so
>>>#4 0x0000002a963e7554 in vtkDataObject::Update ()
>>> from /home/richardb/local/lib/vtk/libvtkCommon.so
>>>#5 0x0000002a964b7f80 in vtkSource::Update ()
>>> from /home/richardb/local/lib/vtk/libvtkCommon.so
>>>#6 0x0000000000435cc7 in volrendVtkApp::importVolume (this=0x57edc0, filename=
>>> {static npos = 18446744073709551615, _M_dataplus =
>>>{<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No
>>>data fields>}, <No data fields>}, _M_p = 0x67a7e8
>>>"/home/richardb/tmp/010007181.img"}})
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>>
>
>
>
More information about the Insight-users
mailing list