資源簡介
DCM文件轉圖像,并高清處理圖像
代碼片段和文件信息
using?System;
using?System.Collections;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Drawing.Imaging;
using?System.IO;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?WindowsFormsApp1
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????}
????????#region?DicomHandler?醫學圖像解析
????????class?DicomHandler
????????{
????????????string?fileName?=?““;
????????????Dictionary?tags?=?new?Dictionary();//dicom文件中的標簽
????????????BinaryReader?dicomFile;//dicom文件流
????????????//文件元信息
????????????public?Bitmap?gdiImg;//轉換后的gdi圖像
????????????UInt32?fileHeadLen;//文件頭長度
????????????long?fileHeadOffset;//文件數據開始位置
????????????UInt32?pixDatalen;//像素數據長度
????????????long?pixDataOffset?=?0;//像素數據開始位置
????????????bool?isLitteEndian?=?true;//是否小字節序(小端在前?、大端在前)
????????????bool?isExplicitVR?=?true;//有無VR
????????????//像素信息
????????????int?colors;//顏色數?RGB為3?黑白為1
????????????public?int?windowWith?=?2048?windowCenter?=?2048?/?2;//窗寬窗位
????????????int?rows?cols;
????????????public?void?readAndShow(out?string?textBox1)
????????????{
????????????????textBox1?=?““;
????????????????if?(fileName?==?string.Empty)
????????????????{
????????????????????textBox1?=?“請選擇文件“;
????????????????}
????????????????else
????????????????{
????????????????????dicomFile?=?new?BinaryReader(File.OpenRead(fileName));
????????????????????//跳過128字節導言部分
????????????????????dicomFile.baseStream.Seek(128?SeekOrigin.Begin);
????????????????????if?(new?string(dicomFile.ReadChars(4))?!=?“DICM“)
????????????????????{
????????????????????????textBox1?=?“沒有dicom標識頭,文件格式錯誤“;
????????????????????}
????????????????????else
????????????????????{
????????????????????????tagRead();
????????????????????????IDictionaryEnumerator?enor?=?tags.GetEnumerator();
????????????????????????while?(enor.MoveNext())
????????????????????????{
????????????????????????????if?(enor.Key.ToString().Length?>?9)
????????????????????????????{
????????????????????????????????textBox1?+=?enor.Key.ToString()?+?“\r\n“;
????????????????????????????????textBox1?+=?enor.Value.ToString().Replace(‘\0‘?‘?‘);
????????????????????????????}
????????????????????????????else
????????????????????????????????textBox1?+=?enor.Key.ToString()?+?enor.Value.ToString().Replace(‘\0‘?‘?‘)?+?“\r\n“;
????????????????????????}
????????????????????????dicomFile.Close();
????????????????????}
????????????????}
????????????}
????????????public?DicomHandler(string?_filename)
????????????{
????????????????fileName?=?_filename;
????????????}
????????????public?void?saveAs(string?filename)
????????????{
????????????????switch?(filename.Substring(filename.LastIndexO
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????32768??2021-01-28?10:32??dcm圖像\.vs\dcm圖像處理\v15\.suo
?????文件??????????0??2021-01-28?10:29??dcm圖像\.vs\dcm圖像處理\v15\Server\sqlite3\db.lock
?????文件???????4096??2021-01-28?10:29??dcm圖像\.vs\dcm圖像處理\v15\Server\sqlite3\storage.ide
?????文件??????32768??2021-01-28?10:29??dcm圖像\.vs\dcm圖像處理\v15\Server\sqlite3\storage.ide-shm
?????文件?????951752??2021-01-28?10:32??dcm圖像\.vs\dcm圖像處理\v15\Server\sqlite3\storage.ide-wal
?????文件???????1146??2021-01-28?10:29??dcm圖像\dcm圖像處理.sln
?????文件????????178??2021-01-28?09:40??dcm圖像\WindowsFormsApp1\App.config
?????文件?????986136??2021-01-27?13:42??dcm圖像\WindowsFormsApp1\bin\Debug\ImageFileName.dcm
?????文件????1963974??2021-01-28?09:41??dcm圖像\WindowsFormsApp1\bin\Debug\ImageFileName.png
?????文件????1963974??2021-01-27?13:52??dcm圖像\WindowsFormsApp1\bin\Debug\test.png
?????文件??????19968??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe
?????文件????????178??2021-01-28?09:40??dcm圖像\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe.config
?????文件??????40448??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.pdb
?????文件??????24018??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\Form1.cs
?????文件???????4714??2021-01-28?10:31??dcm圖像\WindowsFormsApp1\Form1.Designer.cs
?????文件???????6020??2021-01-28?10:31??dcm圖像\WindowsFormsApp1\Form1.resx
?????文件????????987??2021-01-28?09:40??dcm圖像\WindowsFormsApp1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7240??2021-01-28?10:30??dcm圖像\WindowsFormsApp1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2021-01-26?18:55??dcm圖像\WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2021-01-26?18:55??dcm圖像\WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2021-01-26?18:55??dcm圖像\WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件?????????42??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache
?????文件???????2191??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.FileListAbsolute.txt
?????文件???????1012??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.cache
?????文件??????19968??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe
?????文件????????180??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Form1.resources
?????文件??????40448??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb
?????文件????????180??2021-01-28?10:32??dcm圖像\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Properties.Resources.resources
?????文件????????528??2021-01-26?18:55??dcm圖像\WindowsFormsApp1\Program.cs
?????文件???????1344??2021-01-26?18:55??dcm圖像\WindowsFormsApp1\Properties\AssemblyInfo.cs
............此處省略27個文件信息
- 上一篇:人臉識別(基于虹軟ArcSoft)
- 下一篇:Openvc 動態人臉識別對比學習
評論
共有 條評論