@@ -528,8 +528,10 @@ impl FileMetaTableBuilder {
528
528
let information_group_length = match self . information_group_length {
529
529
Some ( e) => e,
530
530
None => {
531
- // determine the expected meta group size based on the given fields
532
- 12 + 14 +
531
+ // determine the expected meta group size based on the given fields.
532
+ // FileMetaInformationGroupLength is not included here
533
+
534
+ 14 +
533
535
8 + dicom_len ( & media_storage_sop_class_uid) +
534
536
8 + dicom_len ( & media_storage_sop_instance_uid) +
535
537
8 + dicom_len ( & transfer_syntax) +
@@ -563,7 +565,7 @@ impl FileMetaTableBuilder {
563
565
564
566
#[ cfg( test) ]
565
567
mod tests {
566
- use super :: FileMetaTable ;
568
+ use super :: { FileMetaTableBuilder , FileMetaTable } ;
567
569
use dicom_core:: value:: Value ;
568
570
use dicom_core:: { dicom_value, DataElement , Tag , VR } ;
569
571
@@ -646,6 +648,39 @@ mod tests {
646
648
assert_eq ! ( table, gt) ;
647
649
}
648
650
651
+ #[ test]
652
+ fn create_meta_table_with_builder ( ) {
653
+ let table = FileMetaTableBuilder :: new ( )
654
+ . information_version ( [ 0 , 1 ] )
655
+ . media_storage_sop_class_uid ( "1.2.840.10008.5.1.4.1.1.1" )
656
+ . media_storage_sop_instance_uid ( "1.2.3.4.5.12345678.1234567890.1234567.123456789.1234567" )
657
+ . transfer_syntax ( "1.2.840.10008.1.2.1" )
658
+ . implementation_class_uid ( "1.2.345.6.7890.1.234" )
659
+ . implementation_version_name ( "RUSTY_DICOM_269" )
660
+ . source_application_entity_title ( "" )
661
+ . build ( )
662
+ . unwrap ( ) ;
663
+
664
+ let gt = FileMetaTable {
665
+ information_group_length : 200 ,
666
+ information_version : [ 0u8 , 1u8 ] ,
667
+ media_storage_sop_class_uid : "1.2.840.10008.5.1.4.1.1.1\0 " . to_owned ( ) ,
668
+ media_storage_sop_instance_uid :
669
+ "1.2.3.4.5.12345678.1234567890.1234567.123456789.1234567\0 " . to_owned ( ) ,
670
+ transfer_syntax : "1.2.840.10008.1.2.1\0 " . to_owned ( ) ,
671
+ implementation_class_uid : "1.2.345.6.7890.1.234" . to_owned ( ) ,
672
+ implementation_version_name : Some ( "RUSTY_DICOM_269 " . to_owned ( ) ) ,
673
+ source_application_entity_title : Some ( "" . to_owned ( ) ) ,
674
+ sending_application_entity_title : None ,
675
+ receiving_application_entity_title : None ,
676
+ private_information_creator_uid : None ,
677
+ private_information : None ,
678
+ } ;
679
+
680
+ assert_eq ! ( table. information_group_length, gt. information_group_length) ;
681
+ assert_eq ! ( table, gt) ;
682
+ }
683
+
649
684
#[ test]
650
685
fn read_meta_table_into_iter ( ) {
651
686
let table = FileMetaTable {
0 commit comments