<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Dear VTK users,</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">I'm new to VTK and ITK, and I still have problems.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">I'm working as a trainee on an existing project. So I can't really show you all of my code because it's cut in a lot of classes, and it's hard for me to find how the existing project works.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Here is my problem:</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">I'm trying to connect ITK and VTK: i get an ITK image, apply itk::ConnectedThresholdImageFilter to it, then connect the pipeline to vtk to stock it in a vtkVolume.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">But the software crashes, and in debug mode I see it crashes in vtkImageImport::InvokeUpdateInformationCallbacks().</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif;
background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">I'm using VTK 5.1 and ITK 3.2.0.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Here is my code:</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> </span>typedef signed short PixelType;</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif;
background-color: transparent; font-style: normal;"><span class="tab"> </span>const unsigned int Dimension = 3;<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> </span>typedef itk::Image< PixelType, Dimension > ImageType;<br><span class="tab"> </span>typedef itk::ImageToVTKImageFilter< ImageType > ITKToVTKConnector;<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px;
font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> //The itk Image<br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> </span>ImageType::Pointer image = this->dicom->getImagePointer();</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> //The connected filter, using a random seed, just to test<br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif;
background-color: transparent; font-style: normal;"><span class="tab"> </span>typedef itk::ConnectedThresholdImageFilter< ImageType, ImageType > ConnectedFilterType;<br> ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();<br> connectedThreshold->SetInput( image);<br> connectedThreshold->SetLower( 150 );<br> connectedThreshold->SetUpper( 350 );<br> connectedThreshold->SetReplaceValue( 255 );<br> ImageType::IndexType index;<br> index[0] = 150;<br> index[1] = 250;<br> index[2] = 150;<br> connectedThreshold->SetSeed( index );<br> connectedThreshold->ReleaseDataFlagOn();<br> connectedThreshold->Update();</div><div style="color: rgb(0, 0, 0); font-size:
16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> </span>//The Connector. I first used it like it's normally used but, as it didn't work, i tried to get the exporter and importer, and see if it works. It doesn't.<br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> </span>ITKToVTKConnector::Pointer connect2=ITKToVTKConnector::New();<br> //connect2->SetInput(connectedThreshold->GetOutput());<br> //connect2->ReleaseDataFlagOn();<br> //connect2->Update();<br>
connect2->GetExporter()->SetInput( connectedThreshold->GetOutput() );<br> connect2->GetImporter()->Update();</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> //The mapper, a class attribute<br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"> volumeRayCastMapper->SetInput(connect2->GetImporter()->GetOutput());<br> volumeRayCastMapper->ReleaseDataFlagOn();<br> volumeRayCastMapper->Update();<br>
<br></span><span class="tab"> //The volume, a class attribute</span><br><span class="tab"></span><span class="tab"> this->getVolume()/*m_lastVolumeCreated*/->SetMapper( volumeRayCastMapper );<br></span><span class="tab"> </span><span class="tab">this->getVolume()/*m_lastVolumeCreated*/->SetProperty( this->volumeProperty );</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span class="tab"></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab">After that, the volume is used in some other classes which Render the volume. The problem seems to be in the end of the ITK pipeline. I don't know what to try anymore.</span></div><div style="color:
rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Any kind of help would be appreciated and, please, excuse my english.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">Thank you,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif;
background-color: transparent; font-style: normal;"><span class="tab"> </span><span class="tab"> </span><span class="tab"> </span><span class="tab"> </span><span class="tab"> </span><span class="tab"> </span><span class="tab"> Crampon</span><br><span class="tab"></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span class="tab"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px;
font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><br></div></div></body></html>