使用有损技术的Dicom图像压缩 [英] Dicom image compression using lossy technique

查看:112
本文介绍了使用有损技术的Dicom图像压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮我压缩DICOM(.dcm)图像文件。

我能够通过使用GZipStrim一类使用System.IO.Compression命名空间来实现它50%压缩,我想要高达80%的压缩。有可能通过使用有损压缩,但我不知道该怎么做?



请帮帮我,我怎样才能实现它??



我是什么尝试过:



string [] sFiles = Directory.GetFiles(sInDir,* .DCM *,SearchOption.AllDirectories);

int iDirLen = sInDir [sInDir.Length - 1] == Path.DirectorySeparatorChar? sInDir.Length:sInDir.Length + 1;



using(FileStream outFile = new FileStream(sOutFile,FileMode.Create,FileAccess.Write,FileShare.ReadWrite))

使用(GZipStream str = new GZipStream(outFile,CompressionLevel.Optimal,true))





foreach( sFiles中的字符串sFilePath)

{

string sRelativePath = sFilePath.Substring(iDirLen);

if(progress!= null)

进度(sRelativePath);

CompressFile(sInDir,sRelativePath,str);

}



它给了我50%的压缩但是想压缩uoto 80%。

Can any one please help me in compression of DICOM(.dcm) image file.
I am able to do it by using GZipStrim a class of using System.IO.Compression namespace which gives upto 50% compression and i want upto 80% compression. It may be possible by using lossy compression but i don't know how to do it?

please help me out how can i achieve it...?

What I have tried:

string[] sFiles = Directory.GetFiles(sInDir, "*.DCM*", SearchOption.AllDirectories);
int iDirLen = sInDir[sInDir.Length - 1] == Path.DirectorySeparatorChar ? sInDir.Length : sInDir.Length + 1;

using (FileStream outFile = new FileStream(sOutFile, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
using (GZipStream str = new GZipStream(outFile, CompressionLevel.Optimal,true))


foreach (string sFilePath in sFiles)
{
string sRelativePath = sFilePath.Substring(iDirLen);
if (progress != null)
progress(sRelativePath);
CompressFile(sInDir, sRelativePath, str);
}

it is giving me 50% compression but wants to compress uoto 80%.

推荐答案

Gzip是通用的压缩工具,它不需要了解什么是压缩。

使用有损压缩,该工具需要了解什么是压缩的。



因此对于有损压缩,您需要:

- 打开文件并将其加载到图片/位图对象中。

- 然后将压缩应用于对象。

您必须在对象的已知压缩之间进行选择。通常,当对象以通常为JPEG的给定格式保存时,将完成压缩。
Gzip is general purpose compression tool, it don't have to understand what is compressed.
With lossy compression, the tool need to understand what is compressed.

So for lossy compression, you need:
- Open the file and load it in a picture/bitmap object.
- then apply the compression to the object.
you will have to choose between available compressions known of the object. Generally the compression is done when the object is saved in a given format usually JPEG.


这篇关于使用有损技术的Dicom图像压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆