@@ -216,7 +216,7 @@ pub enum PixelAnnotationTarget {
216
216
217
217
#[ derive( Component ) ]
218
218
pub struct GenerateChannelImage {
219
- pub identifier : ChannelIdentifier ,
219
+ pub identifier : Option < ChannelIdentifier > ,
220
220
}
221
221
222
222
#[ derive( Debug , Clone ) ]
@@ -1401,33 +1401,33 @@ fn image_control_changed(
1401
1401
* 255.0 )
1402
1402
as u8 ;
1403
1403
1404
- if intensity > 0 {
1405
- match control. image_update_type {
1406
- ImageUpdateType :: Red => {
1407
- image. data [ index * 4 ] = intensity;
1408
- }
1409
- ImageUpdateType :: Green => {
1410
- image. data [ index * 4 + 1 ] = intensity;
1411
- }
1412
- ImageUpdateType :: Blue => {
1413
- image. data [ index * 4 + 2 ] = intensity;
1414
- }
1415
- ImageUpdateType :: All => {
1416
- image. data [ index * 4 ] = intensity;
1417
- image. data [ index * 4 + 1 ] = intensity;
1418
- image. data [ index * 4 + 2 ] = intensity;
1419
- }
1404
+ match control. image_update_type {
1405
+ ImageUpdateType :: Red => {
1406
+ image. data [ index * 4 ] = intensity;
1407
+ }
1408
+ ImageUpdateType :: Green => {
1409
+ image. data [ index * 4 + 1 ] = intensity;
1410
+ }
1411
+ ImageUpdateType :: Blue => {
1412
+ image. data [ index * 4 + 2 ] = intensity;
1413
+ }
1414
+ ImageUpdateType :: All => {
1415
+ image. data [ index * 4 ] = intensity;
1416
+ image. data [ index * 4 + 1 ] = intensity;
1417
+ image. data [ index * 4 + 2 ] = intensity;
1420
1418
}
1419
+ }
1421
1420
1422
- // let intensity = image.data[index * 4 + 2]
1423
- // .max(image.data[index * 4 + 1])
1424
- // .max(image.data[index * 4]);
1425
- // let alpha = match intensity {
1426
- // 0..=25 => intensity * 10,
1427
- // _ => 255,
1428
- // };
1421
+ // let intensity = image.data[index * 4 + 2]
1422
+ // .max(image.data[index * 4 + 1])
1423
+ // .max(image.data[index * 4]);
1424
+ // let alpha = match intensity {
1425
+ // 0..=25 => intensity * 10,
1426
+ // _ => 255,
1427
+ // };
1429
1428
1430
- // image.data[index * 4 + 3] = alpha;
1429
+ // image.data[index * 4 + 3] = alpha;
1430
+ if intensity > 0 {
1431
1431
image. data [ index * 4 + 3 ] = 255 ;
1432
1432
}
1433
1433
}
@@ -1490,10 +1490,21 @@ fn generate_channel_image(
1490
1490
// Remove children from the image control (previously loaded data)
1491
1491
commands. entity ( entity) . despawn_descendants ( ) ;
1492
1492
1493
+ // We are generating the channel image, so we can remove this
1494
+ commands. entity ( entity) . remove :: < GenerateChannelImage > ( ) ;
1495
+
1493
1496
if let Ok ( imc) = q_imc. get ( parent. get ( ) ) {
1494
1497
let start = Instant :: now ( ) ;
1495
1498
1496
- match imc. channel_image ( & generate. identifier ) {
1499
+ let Some ( identifier) = & generate. identifier else {
1500
+ image_control. histogram = vec ! [ ] ;
1501
+ image_control. intensity_range = ( 0.0 , f32:: INFINITY ) ;
1502
+ image_control. colour_domain = ( 0.0 , f32:: INFINITY ) ;
1503
+
1504
+ continue ;
1505
+ } ;
1506
+
1507
+ match imc. channel_image ( identifier) {
1497
1508
Ok ( mut channel_images) => {
1498
1509
let duration = start. elapsed ( ) ;
1499
1510
@@ -1562,8 +1573,5 @@ fn generate_channel_image(
1562
1573
}
1563
1574
}
1564
1575
}
1565
-
1566
- // We are finished with generating the channel image, so we can remove this
1567
- commands. entity ( entity) . remove :: < GenerateChannelImage > ( ) ;
1568
1576
}
1569
1577
}
0 commit comments