[Insight-users] strainge behaviar ..

Luis Ibanez luis.ibanez at kitware.com
Fri, 30 Apr 2004 20:51:11 -0400


Hi Yasser,

Please include the typedef declarations of your
images.

If you are using "unsigned char" as pixel type,
the value "400" would be converted to 400 modulo
255....

Chances are that you are not using a pixel type
appropiate for your input DICOM images.

Note that VTK filters use a runtiime mechanism
for selecting the pixel type. It is also possible
that the image pixel type is being changed by the
defaults in one of the VTK filters....

The easy way to verify is to track the intermediate
results of the pipeline.


   Regards,



     Luis



--------------------
yasser salman wrote:

>  
>  Hi Luis..,
>  it's My code as u recommended , When i change
> "SegmentedRegionColor" from 255 to 400 (for
>  Example) a Minor ( not Major) Changes Occured at the
> 3d segmented Region , Also the region didn't displayed
>  when a change the SegmentedRegionColor from 255 to
> 195 , or 150 ..,
> Also the Attachment files is my test files..,
> 
> 
> 
> 
> 
>  typedef itk::ImageSeriesReader< InputImageType >    
> ReaderType;
> 
>   itk::DICOMImageIO2::Pointer dicomIO =
> itk::DICOMImageIO2::New();
> 
>   // Get the DICOM filenames from the directory
>   itk::DICOMSeriesFileNames::Pointer nameGenerator =
> itk::DICOMSeriesFileNames::New();
>  CString  directoryname(VolData_FName);
> 
>   std::string    stringdirectory =
> directoryname.GetBuffer(200);
> 
>  // nameGenerator->SetDirectory(  stringdirectory );
> it works !
> 
>   nameGenerator->SetDirectory(
> "D:/imagedata/Dicom/shy4" );
> 
>   typedef std::vector<std::string> seriesIdContainer;
>   const seriesIdContainer & seriesUID =
> nameGenerator->GetSeriesUIDs();
> seriesIdContainer::const_iterator seriesItr =
> seriesUID.begin();
>   seriesIdContainer::const_iterator seriesEnd =
> seriesUID.end();
>   while( seriesItr != seriesEnd )
>     {
>     std::cout << seriesItr->c_str() << std::endl;
>     seriesItr++;
>     }
>   
>   typedef
> itk::RelabelComponentImageFilter<SegmentedImageType,SegmentedImageType>
> RelabelImageFilter;
>   typedef std::vector<std::string> fileNamesContainer;
>   fileNamesContainer fileNames;
>    fileNames = nameGenerator->GetFileNames();
>   
>   
>   ReaderType::Pointer reader = ReaderType::New();
>   reader->SetFileNames( fileNames );
>   reader->SetImageIO( dicomIO );
> 
>     reader->Update();
>   
> 
>   CastImageFilterType::Pointer cast =
> CastImageFilterType::New();
> 
>   
>  
>   ConnectedFilterType::Pointer connectedThreshold = 
> ConnectedFilterType::New();
>   RelabelImageFilter::Pointer rcfilter=
> RelabelImageFilter::New();
>   VTK2ITKConnectorFilterType::Pointer VTK2ITKconnector
> = 
> VTK2ITKConnectorFilterType::New();
> 
>   
> 
>   cast->SetInput( reader->GetOutput() );
> 
>   smoothing->SetInput(  cast->GetOutput() );
>   confidence->SetInput( smoothing->GetOutput());
> 
>   smoothing->SetTimeStep( 0.0625 );
>  smoothing->SetNumberOfIterations( 2 );
>     connectedThreshold->SetInput(
> smoothing->GetOutput() );
>   connectedThreshold->SetLower(  L_threshold  );
>   connectedThreshold->SetUpper(  H_threshold);
>   connectedThreshold->SetReplaceValue(
> SegmentedRegionColor );  //SegmentedRegionColor=255 
> 
> 
>   typedef ConnectedFilterType::IndexType IndexType;
>   IndexType seed;
>   seed[0] = axi;  //126
>   seed[1] = cron; //126
>   seed[2] = sag; //8
> 
>   connectedThreshold->SetSeed( seed );
>   connectedThreshold->Update();
> 
>   
>   ITK2VTKConnectorFilterType::Pointer ITK2VTKconnector
> = 
> ITK2VTKConnectorFilterType::New();
> rcfilter->SetInput(connectedThreshold->GetOutput());
> rcfilter->Update();
> 	unsigned long nObjects =
> rcfilter->GetNumberOfObjects();
> 	const std::vector<unsigned long> sizeOfObjects =
> rcfilter->GetSizeOfObjectsInPixels();
> 	std::vector<unsigned long>::const_iterator it;
> 
> 	int i;
> 	 it =  sizeOfObjects.begin();  	
> 
> 
>   ITK2VTKconnector->SetInput(connectedThreshold
> ->GetOutput());
>  
> ITK2VTKconnector->GetImporter()->SetDataScalarTypeToUnsignedChar();
>   
>   //----------------------------------
>   //           VTK Pipeline
>   //----------------------------------
> 
>  GaussianRegion->SetStandardDeviations (5, 2, 1);
>      GaussianRegion-> SetRadiusFactors (1.0, 1.0,
> 1.0);
> GaussianRegion
> ->SetInput(ITK2VTKconnector->GetOutput());
> 
> 
> mcTumor->SetInput(GaussianRegion->GetOutput());
> 
> mcTumor->SetValue(0,127);
> 	mcmapTumor->SetInput(mcTumor->GetOutput());
> 	mcmapTumor->ScalarVisibilityOff();
> 	mcactorTumor->SetMapper(mcmapTumor); 
>     ren->AddActor(mcactorTumor);
> 	renWin->AddRenderer( ren );
>   renWin->SetInteractor( iren );
> renWin->SetSize((rect.right-rect.left)/2,(rect.bottom-rect.top)/2);
> renWin->SetPosition(10,10);
> 	iren->SetDesiredUpdateRate(3.0);
> 	vtkCamera *aCamera2 =vtkCamera::New();
> 	ren->SetBackground( 0.1, 0.2, 0.4 );
> 	ren->SetActiveCamera(aCamera2);
> 	ren->ResetCamera();
> 	aCamera2->Dolly(0);	
> 
> iren->Initialize();
>   renWin->Render();
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25¢
> http://photos.yahoo.com/ph/print_splash
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>