itk 获取图像数据的文件存储类型

  void GetImageType(std::string fileName,
                    ImageIOBase::IOPixelType &pixelType,
                    ImageIOBase::IOComponentType &componentType)
  {
    typedef itk::Image ImageType;
    itk::ImageFileReader::Pointer imageReader =
        itk::ImageFileReader::New();
    imageReader->SetFileName(fileName.c_str());
    imageReader->UpdateOutputInformation();

    pixelType = imageReader->GetImageIO()->GetPixelType();
    componentType = imageReader->GetImageIO()->GetComponentType();
  }

你可能感兴趣的:(itk)