fix:修改updateROI接口参数;2 增加/selfStation/getGammaGated接口

This commit is contained in:
xiaoguangbin 2024-07-24 16:46:44 +08:00
parent 48a03b6d6f
commit 1f94e14a70

View File

@ -2944,6 +2944,56 @@ public class SelfStationServiceImpl implements ISelfStationService {
return result;
}
@Override
public Result getGammaGated(Integer chartHeight, Integer channelWidth, Integer gammaChannel, Integer sampleId, String qcFileName, String sampleFileName, HttpServletRequest request) {
Result result = new Result();
Map<String, Object> map = new HashMap<>();
//获取用户名称
String userName = JwtUtil.getUserNameByToken(request);
//获取自建台站缓存信息
Cache<String, SelfStationData> selfCache = selfStationCache.getSelfCache();
SelfStationData betaDataFile = selfCache.getIfPresent(sampleFileName + StringPool.DASH + userName);
// Cache<String, BetaDataFile> cache = betaCache.getBetaCache();
// BetaDataFile betaDataFile = cache.getIfPresent(sampleFileName + "-" + userName);
if (Objects.isNull(betaDataFile)) {
result.error500("Load basic file information first!");
return result;
}
//选择矩形框高度
Integer flagHeight = channelWidth * (chartHeight/256);
int value = Double.valueOf(flagHeight / 2).intValue();
//计算得到最高值
int up = gammaChannel - value;
if (up<0){
up = 0;
}
//计算得到最低值
int down = up + value;
EnergySpectrumStruct struct = betaDataFile.getQcStruct();
if (Objects.nonNull(struct)) {
//Beta-Gamma Spectrum: QC
long bChannels = struct.b_channels;
List<Long> hCounts = struct.h_counts;
List<SeriseData> serise_data = new LinkedList<>();
for ( int i=0; i<bChannels; ++i ) {
long count = 0;
for (int j=up; j<=down; ++j) {
Long index = j * bChannels + i;
count += hCounts.get(index.intValue());
}
SeriseData temp = new SeriseData();
temp.setX(i);
temp.setY(count);
serise_data.add(temp);
}
map.put("data", serise_data);
}
result.setSuccess(true);
result.setResult(map);
return result;
}
@Override
@DS("ora")
public Result NuclideLibrary(Integer sampleId, String fileName, String editEnergy, double err, String libraryName, String nuclideName, HttpServletRequest request) {