示例#1
0
	void initialiseFilters() {
		// resamplers
		transform = TransformType::New();
	  transform->SetIdentity();
    volumeInterpolator = VolumeInterpolatorType::New();
		maskVolumeInterpolator = MaskVolumeInterpolatorType::New();
		resampler = ResamplerType::New();
    resampler->SetInput( originalImage );
		resampler->SetInterpolator( volumeInterpolator );
		resampler->SetOutputSpacing( resamplerSpacing );
		resampler->SetSize( resamplerSize );
		resampler->SetTransform( transform );
		resampler->SetDefaultPixelValue( 127 );
		maskResampler = MaskResamplerType::New();
		maskResampler->SetInput( originalMask );
		maskResampler->SetInterpolator( maskVolumeInterpolator );
		maskResampler->SetOutputSpacing( resamplerSpacing );
		maskResampler->SetSize( resamplerSize );
		maskResampler->SetTransform( transform );
		
		// extract image filters
    sliceExtractor = SliceExtractorType::New();
    sliceExtractor->SetInput( resampler->GetOutput() );
		maskSliceExtractor = MaskSliceExtractorType::New();
    maskSliceExtractor->SetInput( maskResampler->GetOutput() );
    
    // masks
    for(unsigned int i=0; i<resamplerSize[2]; i++) {
  		masks2D.push_back( MaskType2D::New() );
    }		
	}
示例#2
0
 void ResampleResult(const char* name) {
     InterpolatorNN::Pointer resampleInterpolator = InterpolatorNN::New();
     ResamplerType::Pointer resample = ResamplerType::New();
     resample->SetTransform(_finalTransform);
     resample->SetInput(_src);
     resample->UseReferenceImageOn();
     resample->SetReferenceImage(_dst);
     resample->SetInterpolator(resampleInterpolator);
     resample->Update();
     ImageType::Pointer resampledImage = resample->GetOutput();
     itkcmds::itkImageIO<ImageType> io;
     io.WriteImageT(name, resampledImage);
 }