[Insight-users] strainge behaviar ..

yasser salman yass71 at yahoo.com
Fri, 23 Apr 2004 05:01:31 -0700 (PDT)


 
 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