[ITK-users] why jpg image that is converted from a mhd image is so weird ?
XieYi
xieyi4650 at 126.com
Wed Jun 7 07:45:00 EDT 2017
the mhd image in ParaView software is like this:
<http://itk-users.7.n7.nabble.com/file/n38307/gt1.png>
after being converted to jpg image, it is like this
<http://itk-users.7.n7.nabble.com/file/n38307/drr.jpg>
here is my converting code:
typedef float PixelType;
const unsigned int Dimension = 3;
typedef itk::Matrix<double, 3, 3> MatrixType;
#ifdef RTK_USE_CUDA
typedef itk::CudaImage< PixelType, Dimension > ImageType;
#else
typedef itk::Image< PixelType, Dimension > ImageType;
#endif
typedef itk::RGBPixel<unsigned char> PixelType_2D;
#ifdef RTK_USE_CUDA
typedef itk::CudaImage< PixelType_2D, 2 > ImageType;
#else
typedef itk::Image<PixelType_2D, 2> ImageType2;
#endif
typedef itk::JPEGImageIO ImageIOType;
ImageIOType::Pointer jpegIO = ImageIOType::New();
ImageType::Pointer drr1 = [a function get a image]
typedef itk::CastImageFilter <ImageType, ImageType2> ImageCastType;
ImageCastType::Pointer Imagecast = ImageCastType::New();
Imagecast->SetInput(drr1);
Imagecast->Update();
jpegIO->SetFileTypeToASCII();
typedef itk::ImageFileWriter<ImageType2> WriterType2;
WriterType2::Pointer writer_jpg = WriterType2::New();
writer_jpg->SetImageIO(jpegIO);
writer_jpg->SetFileName("drr.jpg");
writer_jpg->SetInput(Imagecast->GetOutput());
writer_jpg->Update();
--
View this message in context: http://itk-users.7.n7.nabble.com/why-jpg-image-that-is-converted-from-a-mhd-image-is-so-weird-tp38307.html
Sent from the ITK - Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list