资源简介
用C#写得处理DCOM文件源码
代码片段和文件信息
/*
* Copyright (c) 2011 Anders Gustafsson Cureos AB.
* This file is part of mdcm.
*
* mdcm is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation either
* version 3 of the License or (at your option) any later version.
*
* mdcm is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mdcm.
* If not see .
*/
using System;
using System.IO;
using System.Text;
using Dicom;
using Dicom.Data;
using Dicom.IO;
namespace dcm2txt
{
internal class Program
{
private static void Main(string[] args)
{
if (args.Length == 0 || args.Length > 2 ||
(args.Length == 2 && args[0].Equals(args[1] StringComparison.InvariantCultureIgnoreCase)))
{
Console.WriteLine(“usage: dcm2txt dcmfile-in [txtfile-out]“);
return;
}
var dcmFileName = args[0];
if (!File.Exists(dcmFileName))
{
Console.WriteLine(“dcm2txt: Specified DICOM file ‘{0}‘ does not exist or cannot be accessed.“
dcmFileName);
return;
}
if (File.Exists(“dicom.dic“))
DcmDictionary.ImportDictionary(“dicom.dic“);
else
DcmDictionary.LoadInternalDictionary();
if (File.Exists(“private.dic“))
DcmDictionary.ImportDictionary(“private.dic“);
string dump;
try
{
var dcmFile = new DicomFileFormat();
if (dcmFile.Load(dcmFileName DicomReadOptions.Default) == DicomReadStatus.Success)
{
var sb = new StringBuilder();
if (dcmFile.FilemetaInfo != null)
dcmFile.FilemetaInfo.Dump(sb String.Empty DicomDumpOptions.None);
if (dcmFile.Dataset != null)
{
dcmFile.Dataset.Dump(sb String.Empty DicomDumpOptions.None);
}
else
{
Console.WriteLine(“dcm2txt: Missing dataset in DICOM file ‘{0}‘.“ dcmFileName);
return;
}
dump = sb.ToString();
}
else
{
Console.WriteLine(“dcm2txt: ‘{0}‘ does not appear to be a DICOM file.“ dcmFileName);
return;
}
}
catch (Exception e)
{
Console.WriteLine(“dcm2txt: Dumping
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 213 2012-02-01 18:39 MDCM\.gitignore
文件 146432 2012-02-01 18:39 MDCM\3rd Party\Aga.Controls.dll
文件 388096 2012-02-01 18:39 MDCM\3rd Party\NLog.dll
文件 1116 2012-02-01 18:39 MDCM\3rd Party\NUnit\license.txt
文件 32768 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit-console-runner.dll
文件 4608 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit-console.exe
文件 188416 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit-gui-runner.dll
文件 139264 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.core.dll
文件 57344 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.core.interfaces.dll
文件 5632 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.exe
文件 135168 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.fr
文件 548987 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.fr
文件 20480 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.mocks.dll
文件 90112 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.uiexception.dll
文件 258048 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.uikit.dll
文件 126976 2012-02-01 18:39 MDCM\3rd Party\NUnit\nunit.util.dll
文件 1501696 2012-02-01 18:39 MDCM\3rd Party\OpenSSL\libeay32.x64.dll
文件 1122304 2012-02-01 18:39 MDCM\3rd Party\OpenSSL\libeay32.x86.dll
文件 331776 2012-02-01 18:39 MDCM\3rd Party\OpenSSL\ssleay32.x64.dll
文件 274432 2012-02-01 18:39 MDCM\3rd Party\OpenSSL\ssleay32.x86.dll
文件 51712 2012-02-01 18:39 MDCM\3rd Party\SL\FJ.Core.dll
文件 80384 2012-02-01 18:39 MDCM\3rd Party\SL\Ionic.Zlib.dll
文件 215552 2012-02-01 18:39 MDCM\3rd Party\SL\NLog.dll
文件 31744 2012-02-01 18:39 MDCM\3rd Party\SL\WriteableBitmapEx.dll
文件 141 2012-02-01 18:39 MDCM\dcm2txt\app.config
文件 141 2012-02-01 18:39 MDCM\dcm2txt\bin\Debug\dcm2txt.exe.config
文件 11600 2012-03-06 15:47 MDCM\dcm2txt\bin\Debug\dcm2txt.vshost.exe
文件 141 2012-02-01 18:39 MDCM\dcm2txt\bin\Debug\dcm2txt.vshost.exe.config
文件 490 2010-03-17 22:39 MDCM\dcm2txt\bin\Debug\dcm2txt.vshost.exe.manifest
文件 2638 2012-02-01 18:39 MDCM\dcm2txt\dcm2txt.csproj
............此处省略1728个文件信息
评论
共有 条评论