整理影像缩略图 和获取影像路径
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
using FellowOakDicom.Imaging;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
|
||||
namespace IRaCIS.Core.Application.Dicom
|
||||
{
|
||||
public static class DicomRenderingHelper
|
||||
{
|
||||
public static Stream RenderPreviewJpeg(string filePath)
|
||||
{
|
||||
string jpegPath = filePath + ".preview.jpg";
|
||||
|
||||
if (!File.Exists(jpegPath))
|
||||
{
|
||||
using (Stream stream = new FileStream(jpegPath, FileMode.Create))
|
||||
{
|
||||
DicomImage image = new DicomImage(filePath);
|
||||
//image.ShowOverlays = false;
|
||||
//image.Scale = Math.Min(Math.Min(128.0 / image.Width, 128.0 / image.Height), 1.0);
|
||||
//image.RenderImage().AsClonedBitmap().Save(stream, ImageFormat.Jpeg);
|
||||
|
||||
var sharpimage = image.RenderImage().AsSharpImage();
|
||||
|
||||
sharpimage.Save(stream, new JpegEncoder());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return new FileStream(jpegPath, FileMode.Open);
|
||||
}
|
||||
|
||||
public static void RemovePreviewJpeg(string filePath)
|
||||
{
|
||||
string jpegPath = filePath + ".preview.jpg";
|
||||
if (File.Exists(jpegPath)) File.Delete(jpegPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace IRaCIS.Core.Application.Services
|
||||
{
|
||||
static class IdentifierHelper
|
||||
{
|
||||
//private static MD5 md5 = new MD5CryptoServiceProvider
|
||||
//
|
||||
private static MD5 md5 = MD5.Create();
|
||||
|
||||
private static object lockObj =new object();
|
||||
|
||||
public static Guid CreateGuid(params string[] parts)
|
||||
{
|
||||
lock (lockObj)
|
||||
{
|
||||
return new Guid(md5.ComputeHash(Encoding.UTF8.GetBytes(string.Concat(parts))));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user