Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
CarerayImage
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0faaa9d2
由
刘韬
编写于
2025-12-26 20:35:28 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
优化GetImage 阻塞模式
1 个父辈
79c08d62
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
21 行删除
CarerayImage/XrayImage.cs
CarerayImage/haobo_v2.cs
CarerayImage/XrayImage.cs
查看文件 @
0faaa9d
...
@@ -255,10 +255,11 @@ namespace Asa
...
@@ -255,10 +255,11 @@ namespace Asa
errmsg
=
""
;
errmsg
=
""
;
if
(
NeoX
.
HasNeox
()
&&
type
.
StartsWith
(
"ID"
))
if
(
NeoX
.
HasNeox
()
&&
type
.
StartsWith
(
"ID"
))
{
{
var
tf
=
GetTemplateFile
(
path
);
var
tf
=
GetTemplateFile
(
path
,
out
string
errmsg2
);
if
(!
string
.
IsNullOrEmpty
(
tf
))
if
(!
string
.
IsNullOrEmpty
(
tf
))
type
=
"ID_TYPE_T"
;
type
=
"ID_TYPE_T"
;
var
result
=
NeoX
.
AlgoC
(
path
,
tf
,
ShrinkOffset
,
0
,
type
,
out
int
c
,
out
Bitmap
bitmap
,
out
errmsg
);
var
result
=
NeoX
.
AlgoC
(
path
,
tf
,
ShrinkOffset
,
0
,
type
,
out
int
c
,
out
Bitmap
bitmap
,
out
errmsg
);
errmsg
+=
errmsg2
;
count
=
new
int
[
4
]
{
c
,
0
,
0
,
0
};
count
=
new
int
[
4
]
{
c
,
0
,
0
,
0
};
BmpDstImg
=
bitmap
;
BmpDstImg
=
bitmap
;
return
result
?
0
:-
1
;
return
result
?
0
:-
1
;
...
@@ -276,10 +277,11 @@ namespace Asa
...
@@ -276,10 +277,11 @@ namespace Asa
eyemImageFree
(
ref
eyem
);
eyemImageFree
(
ref
eyem
);
return
n
;
return
n
;
}
}
public
static
string
GetTemplateFile
(
string
path
)
public
static
string
GetTemplateFile
(
string
path
,
out
string
debugstr
)
{
{
try
try
{
{
debugstr
=
""
;
// 提取文件名中等于号前面的部分
// 提取文件名中等于号前面的部分
string
fileName
=
Path
.
GetFileNameWithoutExtension
(
path
);
string
fileName
=
Path
.
GetFileNameWithoutExtension
(
path
);
var
splitchar
=
ConfigHelper
.
Config
.
Get
(
"PN_Split_Char"
,
"-"
);
var
splitchar
=
ConfigHelper
.
Config
.
Get
(
"PN_Split_Char"
,
"-"
);
...
@@ -311,13 +313,15 @@ namespace Asa
...
@@ -311,13 +313,15 @@ namespace Asa
}
}
else
else
{
{
return
""
;
// 文件不存在,返回空
debugstr
=
"not Exists:"
+
fullPath
;
// 文件不存在,返回空
return
""
;
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
// 处理异常,如路径无法访问、文件名无效等
// 处理异常,如路径无法访问、文件名无效等
Console
.
WriteLine
(
$
"Error: {ex}"
);
Console
.
WriteLine
(
$
"Error: {ex}"
);
debugstr
=
"Error:"
+
ex
.
ToString
();
return
""
;
return
""
;
}
}
}
}
...
@@ -379,7 +383,7 @@ namespace Asa
...
@@ -379,7 +383,7 @@ namespace Asa
try
try
{
{
var
type1
=
ccdata
[
ck
];
var
type1
=
ccdata
[
ck
];
var
tf
=
GetTemplateFile
(
path
);
var
tf
=
GetTemplateFile
(
path
,
out
_
);
if
(!
string
.
IsNullOrEmpty
(
tf
))
if
(!
string
.
IsNullOrEmpty
(
tf
))
type1
=
"ID_TYPE_T"
;
type1
=
"ID_TYPE_T"
;
NeoX
.
AlgoC
(
path
,
tf
,
ShrinkOffset
,
Corner
+
1
,
type1
,
out
int
c
,
out
Bitmap
bitmap
,
out
_
);
NeoX
.
AlgoC
(
path
,
tf
,
ShrinkOffset
,
Corner
+
1
,
type1
,
out
int
c
,
out
Bitmap
bitmap
,
out
_
);
...
...
CarerayImage/haobo_v2.cs
查看文件 @
0faaa9d
...
@@ -260,12 +260,11 @@ namespace Asa
...
@@ -260,12 +260,11 @@ namespace Asa
return
(
windowWidth
,
windowCenter
);
return
(
windowWidth
,
windowCenter
);
}
}
CancellationTokenSource
WaitstopToken
=
new
CancellationTokenSource
();
volatile
bool
buffgetted
=
false
;
volatile
bool
buffgetted
=
false
;
ManualResetEventSlim
buffgettedEvt
=
new
ManualResetEventSlim
(
false
);
int
getpiccount
=
0
;
int
getpiccount
=
0
;
public
bool
GetImage
(
int
_MaxFrameCount
=
3
,
int
MaxDelay
=
5000
)
public
bool
GetImage
(
int
_MaxFrameCount
=
3
,
int
MaxDelay
=
5000
)
{
{
WaitstopToken
=
new
CancellationTokenSource
();
buffer
=
null
;
buffer
=
null
;
//FPD_AQC_MODE stMode = new FPD_AQC_MODE();
//FPD_AQC_MODE stMode = new FPD_AQC_MODE();
...
@@ -283,25 +282,13 @@ namespace Asa
...
@@ -283,25 +282,13 @@ namespace Asa
WriteLog
(
"GetImage start========================"
);
WriteLog
(
"GetImage start========================"
);
getpiccount
=
_MaxFrameCount
;
getpiccount
=
_MaxFrameCount
;
buffgetted
=
false
;
buffgetted
=
false
;
buffgettedEvt
.
Reset
();
int
ret
=
HBI_FPD_DLL
.
HBI_SinglePrepare
(
HBI_FPD_DLL
.
_handel
);
//5
int
ret
=
HBI_FPD_DLL
.
HBI_SinglePrepare
(
HBI_FPD_DLL
.
_handel
);
//5
if
(
ret
!=
0
)
WriteLog
(
"HBI_SinglePrepare:"
+
GetHbiError
(
ret
));
if
(
ret
!=
0
)
WriteLog
(
"HBI_SinglePrepare:"
+
GetHbiError
(
ret
));
else
WriteLog
(
"0x02 prepare成功"
);
else
WriteLog
(
"0x02 prepare成功"
);
buffgettedEvt
.
Wait
(
TimeSpan
.
FromMilliseconds
(
MaxDelay
));
Task
a
=
Task
.
Delay
(
MaxDelay
);
Task
b
=
Task
.
Run
(()=>
{
while
(
true
)
{
Thread
.
Sleep
(
100
);
if
(
buffgetted
)
break
;
}
});
Task
.
WaitAny
(
a
,
b
);
Thread
.
Sleep
(
500
);
/*
/*
if (buffer != null)
if (buffer != null)
{
{
...
@@ -565,7 +552,7 @@ namespace Asa
...
@@ -565,7 +552,7 @@ namespace Asa
if
(
SaveImage
()
==
0
)
// 保存
if
(
SaveImage
()
==
0
)
// 保存
{
{
buffgetted
=
true
;
buffgetted
=
true
;
WaitstopToken
.
Cancel
(
false
);
buffgettedEvt
.
Set
(
);
}
}
#else // 按照8bit图像显示,add by mhyang 20221104
#else // 按照8bit图像显示,add by mhyang 20221104
//int length = imagedata.datalen;
//int length = imagedata.datalen;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论