Fwd: [Insight-users] Re: From Vtk To Itk error error message!
Luis Ibanez
luis.ibanez at kitware.com
Wed, 11 Feb 2004 16:08:46 -0500
Hi Yasser
Thanks for posting the error message.
From your description I understand that the
section of your code that is reading and
visualizing the DICOM files is working ok.
And that the problem is related to the
conversion of the ITK image to VTK image.
or the VTK image to ITK image.
Given that you have
VTK2ITK-->>ITK Filters-->>ITK2VTK-->>Viz pipeline
Could you please try the following:
1) Disconnect the ITK Filter from VTK2ITK and
instead connect and itk::ImageFileWriter
Then trigger the writer.
The purpose of this test is to check
whether the image gets converted to ITK
correctly or not.
If (1) works, then try the following:
(2) reconnect the ITK filters and
the conversion ITK2VTK but keep
the visualization pipeline away.
Connect an vtk writer at the
output of ITK2VTK and run the
pipeline. This should verify
if the image gets passes back to
VTK correctly.
If (2) works, the problem is in the
section between the vtkImageData
generated by ITK2VTK and the viz pipeline.
Please let us know what you find.
Thanks
Luis
----------------------
yasser salman wrote:
> Note: forwarded message attached.
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
>
>
> ------------------------------------------------------------------------
>
> Subject:
> [Insight-users] Re: From Vtk To Itk error message!
> From:
> yasser salman <yass71 at yahoo.com>
> Date:
> Wed, 11 Feb 2004 04:44:44 -0800 (PST)
> To:
> insight-users at itk.org
>
>
> hi luis ..,
> here is the error message..,
> thanx..
> yasser
> --- Luis Ibanez <luis.ibanez at kitware.com> wrote:
>
>>
>>Hi Yasser,
>>
>>
>>Could you please share with us the
>>run time error message that you get ?
>>
>>
>>That will help us a lot :-)
>>
>>
>>Thanks
>>
>>
>> Luis
>>
>>
>>
>>---------------------
>>yasser salman wrote:
>>
>>
>>>hi Luis..,
>>>the same Runtime Error Message Appeared,, the
>>
>>first
>>
>>>part working good (displayed the dicom files found
>>
>>in
>>
>>>../../Nesma1)
>>>at the second part the vtk Renderwindow
>>
>>initialized
>>
>>>to display the output files after volume processed
>>
>>by
>>
>>>itk filters but the run
>>>time error message occured,, what i did..,
>>>1- update my itk to ver 1.6.0 . run Cmake and
>>
>>complie
>>
>>>a new itk.dsw (no problem)
>>>2- update my itkApplication to ver1.6.0 ..
>>>3- minimize my code to avoid itk filters in order
>>
>>to
>>
>>>Detect where the problem is ,I found that the same
>>
>>>run time Error message occured , i excepect that
>>
>>the
>>
>>>error in VTK2ITKconnector->SetInput( Reader
>>>->GetOutput() );
>>>so i check out the itkVTKImageToImageFilter.h and
>>>found that
>>> void SetInput( vtkImageData * );
>>>and also itkVTKImageToImageFilter.txx found that
>>>
>>>VTKImageToImageFilter<TOutputImage>
>>>::SetInput( vtkImageData * inputImage )
>>>
>>>does it mean any thing about the error.., here is
>>
>>the
>>
>>>mini code that i did..,
>>>thanx Luis and waiting ur suggestion about that
>>
>>..,
>>
>>>yasser ..,
>>>
>>>
>>>
>>>
>>>int main( int argc, char ** argv )
>>>{
>>>
>>>
>>> typedef unsigned char InputPixelType;
>>> typedef unsigned char InternalPixelType;
>>> typedef unsigned char SegmentedPixelType;
>>>
>>> typedef itk::Image< InputPixelType, 3 >
>>>InputImageType;
>>> typedef itk::Image< InternalPixelType, 3>
>>>InternalImageType;
>>> typedef itk::Image< SegmentedPixelType, 3 >
>>>SegmentedImageType;
>>>
>>>
>>> typedef itk::CastImageFilter<
>>> InputImageType,
>>> InternalImageType >
>>>CastImageFilterType;
>>>
>>>
>>> typedef itk::ImageToVTKImageFilter<
>>>SegmentedImageType >
>>>ITK2VTKConnectorFilterType;
>>>
>>> typedef itk::VTKImageToImageFilter<
>>
>>InputImageType
>>
>>> >
>>>VTK2ITKConnectorFilterType;
>>>
>>>
>>>
>>>
>>> vtkDICOMImageReader
>>>*Reader=vtkDICOMImageReader::New();
>>> vtkImageViewer2 *viewer = vtkImageViewer2::New();
>>
>>
>>
>>> argv[1]="E:/imagedata/Dicom/1Nesma";
>>
>>> Reader->SetDirectoryName(argv[1]);
>>> Reader->Update();
>>> vtkImageFlip *flipY = vtkImageFlip::New();
>>>flipY->SetInput (Reader->GetOutput());
>>>flipY->SetFilteredAxis (1);
>>>
>>> viewer->SetInput(flipY->GetOutput());
>>>int VolData_Images = viewer->GetWholeZMax ();
>>>
>>>
>>>for (int i=1;i<VolData_Images;i++)
>>>{
>>>
>>> viewer->SetZSlice(i);
>>> viewer->SetSize(512,512);
>>> viewer->SetPosition(500,0);
>>> viewer->SetColorWindow(512);
>>> viewer->SetColorLevel(256);
>>> viewer->Render();
>>>
>>>// TODO: Add your command handler code here
>>>}
>>>
>>> //----------------------------------
>>> // ITK Pipeline
>>> //----------------------------------
>>>
>>>
>>> CastImageFilterType::Pointer cast =
>>>CastImageFilterType::New();
>>>
>>> VTK2ITKConnectorFilterType::Pointer
>>
>>VTK2ITKconnector
>>
>>>=
>>>VTK2ITKConnectorFilterType::New();
>>>
>>> VTK2ITKconnector->SetInput( Reader ->GetOutput()
>>
>>);
>>
>>> cast->SetInput( VTK2ITKconnector->GetOutput() );
>>>
>>>
>>>
>>> ITK2VTKConnectorFilterType::Pointer
>>
>>ITK2VTKconnector
>>
>>>=
>>>ITK2VTKConnectorFilterType::New();
>>>
>>> ITK2VTKconnector->SetInput(cast ->GetOutput());
>>>
>>>
>>
> ITK2VTKconnector->GetImporter()->SetDataScalarTypeToUnsignedChar();
>
>>>
>>> //----------------------------------
>>> // VTK Pipeline
>>> //----------------------------------
>>>
>>> vtkRenderer * renderer
>>
>> =
>>
>>>vtkRenderer::New();
>>> vtkRenderWindow * renderWindow
>>
>> =
>>
>>>vtkRenderWindow::New();
>>> vtkRenderWindowInteractor *
>>
>>renderWindowInteractor =
>>
>>>vtkRenderWindowInteractor::New();
>>>vtkImageActor* imageactor = vtkImageActor::New();
>>> renderWindow->AddRenderer( renderer );
>>> renderWindow->SetInteractor(
>>
>>renderWindowInteractor
>>
>>>);
>>> vtkMarchingCubes *mc = vtkMarchingCubes::New();
>>>
>>> mc->SetInput( ITK2VTKconnector->GetOutput() );
>>> mc->SetValue(0,127);
>>>
>>> vtkPolyDataMapper*
>>
>>mcmap=vtkPolyDataMapper::New();
>>
>>> mcmap->SetInput(mc->GetOutput());
>>> mcmap->ScalarVisibilityOff();
>>> vtkActor* mcactor=vtkActor::New();
>>> mcactor->SetMapper(mcmap);
>>> renderer->AddActor(mcactor);
>>> renderer->SetBackground( 0.1, 0.2, 0.4 );
>>>
>>> renderWindow->Render();
>>> renderWindowInteractor->Start();
>>>
>>> return 0;
>>>
>>>}
>>>
>>>
>>
> === message truncated ===
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance: Get your refund fast by filing online.
> http://taxes.yahoo.com/filing.html
>
>
> ------------------------------------------------------------------------
>