How can i read a dicom file in “float pixel format”, using "itkConnectedThresholdImageFilter" and write it to dicom file again?

I test as next, but failed:

	typedef   float           InternalOneFilePixelType;
	const     unsigned int    DimensionOneFile = 2;
	typedef itk::Image< InternalOneFilePixelType, DimensionOneFile >  InternalOneFileImageType;
 


	typedef signed short                            OutputUCharPixelType;
	typedef itk::Image< OutputUCharPixelType, DimensionOneFile > OutputUCharImageType;
	typedef itk::CastImageFilter< InternalOneFileImageType, OutputUCharImageType >
		CastingFilterType;
	CastingFilterType::Pointer caster = CastingFilterType::New();

	 
	typedef  itk::ImageFileReader< InternalOneFileImageType > ReaderType;
	typedef  itk::ImageFileWriter<  OutputUCharImageType  > WriterType;
	ReaderType::Pointer readerOneFile = ReaderType::New();
	WriterType::Pointer writerOneFile = WriterType::New();
	readerOneFile->SetFileName("E:/ITK/results/test80.DCM");
	writerOneFile->SetFileName("E:/ITK/results/ITKFilterTest80.DCM");
	typedef itk::GDCMImageIO           ImageIOType;
	ImageIOType::Pointer gdcmImageIO = ImageIOType::New();
	readerOneFile->SetImageIO(gdcmImageIO);
	try
	{
		readerOneFile->Update();
	}
	catch (itk::ExceptionObject & e)
	{
		std::cerr << "exception in file reader " << std::endl;
		std::cerr << e << std::endl;
		 
	}


	//平滑过滤器是使用图像类型作为模板参数实例化的。
	typedef itk::CurvatureFlowImageFilter< InternalOneFileImageType, InternalOneFileImageType >
		CurvatureFlowImageFilterType;

	CurvatureFlowImageFilterType::Pointer smoothing =
		CurvatureFlowImageFilterType::New();
	//声明区域生长滤波器
	typedef itk::ConnectedThresholdImageFilter< InternalOneFileImageType,
		InternalOneFileImageType > ConnectedFilterType;
	//创建实例
	ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();

 
	//现在是时候连接一个简单的线性管道了。在管道的开头添加一个文件读取器,在结尾添加一个转     换筛选器和写入程序。
	//转换浮点像素类型为整数类型需要使用转换过滤器,因为只有少数图像文件格式支持浮点类型。
	smoothing->SetInput(readerOneFile->GetOutput());
	connectedThreshold->SetInput(smoothing->GetOutput());
	caster->SetInput(connectedThreshold->GetOutput());
	writerOneFile->SetInput(caster->GetOutput());
	 
	smoothing->SetNumberOfIterations(5);
	smoothing->SetTimeStep(0.125);
	 
	const InternalOneFilePixelType lowerThreshold =  220;
	const InternalOneFilePixelType upperThreshold =  255;


	connectedThreshold->SetLower(lowerThreshold);
	connectedThreshold->SetUpper(upperThreshold);
	//这个滤波器的输出是一个二值图像,除了提取的区域外,其他地方都是零值像素。使用方法选择区域内设置的强度值
	connectedThreshold->SetReplaceValue(255);

	InternalOneFileImageType::IndexType  index;
	index[0] = 318;
	index[1] = 428;
	connectedThreshold->SetSeed(index);
	writerOneFile->SetImageIO(gdcmImageIO);
	try
	{
		writerOneFile->Update();
	}
	catch (itk::ExceptionObject & excep)
	{
		std::cerr << "Exception caught !" << std::endl;
		std::cerr << excep << std::endl;
	}`Preformatted text`