73 lines
2.6 KiB
C#
73 lines
2.6 KiB
C#
using IRaCIS.Core.Application.Contracts.Dicom;
|
||
using IRaCIS.Core.Application.Contracts.Dicom.DTO;
|
||
using IRaCIS.Core.Application.Contracts.RequestAndResponse;
|
||
using IRaCIS.Core.Application.Dicom;
|
||
using Microsoft.AspNetCore.Authorization;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Net.Http;
|
||
|
||
namespace IRaCIS.Api.Controllers
|
||
{
|
||
/// <summary>
|
||
/// Series
|
||
/// </summary>
|
||
[Route("series")]
|
||
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Image")]
|
||
public class SeriesController : ControllerBase
|
||
{
|
||
private readonly IDicomArchiveService _dicomArchiveService;
|
||
public SeriesController(IDicomArchiveService dicomArchiveService)
|
||
{
|
||
_dicomArchiveService = dicomArchiveService;
|
||
}
|
||
|
||
|
||
///// <summary> 指定资源Id,获取Dicom检查所属序列信息列表 </summary>
|
||
///// <param name="studyId"> Dicom检查的Id </param>
|
||
//[HttpGet, Route("list/{studyId:guid}")]
|
||
//[AllowAnonymous]
|
||
//public IEnumerable<DicomSeriesDTO> GetSeriesList(Guid studyId)
|
||
//{
|
||
// return _dicomArchiveService.GetSeriesList(studyId);
|
||
//}
|
||
|
||
|
||
/// <summary> 指定资源Id,获取Dicom检查所属序列信息列表 </summary>
|
||
/// <param name="studyId"> Dicom检查的Id </param>
|
||
/// <param name="tpCode"></param>
|
||
[HttpGet, Route("serieslist/{studyId:guid}")]
|
||
[AllowAnonymous]
|
||
public IResponseOutput<IEnumerable<DicomSeriesWithLabelDTO>> GetSeriesList(Guid studyId,string tpCode)
|
||
{
|
||
return ResponseOutput.Ok( _dicomArchiveService.GetSeriesWithLabelList(studyId, tpCode));
|
||
}
|
||
|
||
|
||
[HttpGet, Route("list/{studyId:guid}/{tpCode?}")]
|
||
[AllowAnonymous]
|
||
public IEnumerable<DicomSeriesWithLabelDTO> GetSeriesWithLabelList(Guid studyId, string tpCode)
|
||
{
|
||
return _dicomArchiveService.GetSeriesWithLabelList(studyId, tpCode);
|
||
}
|
||
|
||
|
||
/// <summary> 指定资源Id,渲染Dicom序列的Jpeg预览图像 </summary>
|
||
/// <param name="seriesId"> Dicom序列的Id </param>
|
||
[HttpGet, Route("preview/{seriesId:guid}")]
|
||
[AllowAnonymous]
|
||
public FileContentResult GetSeriesPreview(Guid seriesId)
|
||
{
|
||
string path = _dicomArchiveService.GetSeriesPreview(seriesId);
|
||
using (var sw = DicomRenderingHelper.RenderPreviewJpeg(path))
|
||
{
|
||
var bytes = new byte[sw.Length];
|
||
sw.Read(bytes, 0, bytes.Length);
|
||
sw.Close();
|
||
return new FileContentResult(bytes, "image/jpeg");
|
||
}
|
||
}
|
||
}
|
||
}
|