@@ -560,19 +560,19 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
560
560
tasks = []
561
561
nii_segmentation_inputs : list [NIISegmentationInput ] = []
562
562
mask_segmentation_inputs : list [MaskInput ] = []
563
- for input in inputs :
564
- if isinstance (input , ExtraDataInput ):
563
+ for i in inputs :
564
+ if isinstance (i , ExtraDataInput ):
565
565
tasks .append (
566
566
ProcessExtraDataTask (
567
- path = input .input_path ,
567
+ path = i .input_path ,
568
568
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
569
569
)
570
570
)
571
- elif isinstance (input , MAPInput ):
571
+ elif isinstance (i , MAPInput ):
572
572
self .store_internal_volume (
573
573
internal_volume = InternalVolume (
574
574
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
575
- volume_input_path = input .input_path ,
575
+ volume_input_path = i .input_path ,
576
576
params_for_storing = self .preprocessor_input .storing_params ,
577
577
volume_force_dtype = self .preprocessor_input .volume .force_volume_dtype ,
578
578
quantize_dtype_str = self .preprocessor_input .volume .quantize_dtype_str ,
@@ -589,11 +589,11 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
589
589
internal_volume = self .get_internal_volume ()
590
590
)
591
591
)
592
- elif isinstance (input , SFFInput ):
592
+ elif isinstance (i , SFFInput ):
593
593
self .store_internal_segmentation (
594
594
internal_segmentation = InternalSegmentation (
595
595
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
596
- segmentation_input_path = input .input_path ,
596
+ segmentation_input_path = i .input_path ,
597
597
params_for_storing = self .preprocessor_input .storing_params ,
598
598
downsampling_parameters = self .preprocessor_input .downsampling ,
599
599
entry_data = self .preprocessor_input .entry_data ,
@@ -615,33 +615,14 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
615
615
)
616
616
)
617
617
618
- elif isinstance (input , MaskInput ):
619
- mask_segmentation_inputs .append (input )
620
- # self.store_internal_segmentation(
621
- # internal_segmentation=InternalSegmentation(
622
- # intermediate_zarr_structure_path=self.intermediate_zarr_structure,
623
- # segmentation_input_path=input.input_path,
624
- # params_for_storing=self.preprocessor_input.storing_params,
625
- # downsampling_parameters=self.preprocessor_input.downsampling,
626
- # entry_data=self.preprocessor_input.entry_data,
627
- # )
628
- # )
629
- # tasks.append(
630
- # MaskProcessSegmentationTask(
631
- # internal_segmentation=self.get_internal_segmentation()
632
- # )
633
- # )
634
- # tasks.append(
635
- # MaskMetadataCollectionTask(
636
- # internal_segmentation=self.get_internal_segmentation()
637
- # )
638
- # )
639
-
640
- elif isinstance (input , OMEZARRInput ):
618
+ elif isinstance (i , MaskInput ):
619
+ mask_segmentation_inputs .append (i )
620
+
621
+ elif isinstance (i , OMEZARRInput ):
641
622
self .store_internal_volume (
642
623
internal_volume = InternalVolume (
643
624
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
644
- volume_input_path = input .input_path ,
625
+ volume_input_path = i .input_path ,
645
626
params_for_storing = self .preprocessor_input .storing_params ,
646
627
volume_force_dtype = self .preprocessor_input .volume .force_volume_dtype ,
647
628
quantize_dtype_str = self .preprocessor_input .volume .quantize_dtype_str ,
@@ -657,7 +638,7 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
657
638
self .store_internal_segmentation (
658
639
internal_segmentation = InternalSegmentation (
659
640
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
660
- segmentation_input_path = input .input_path ,
641
+ segmentation_input_path = i .input_path ,
661
642
params_for_storing = self .preprocessor_input .storing_params ,
662
643
downsampling_parameters = self .preprocessor_input .downsampling ,
663
644
entry_data = self .preprocessor_input .entry_data ,
@@ -676,11 +657,11 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
676
657
OMEZARRAnnotationsCollectionTask (self .get_internal_volume ())
677
658
)
678
659
679
- elif isinstance (input , GeometricSegmentationInput ):
660
+ elif isinstance (i , GeometricSegmentationInput ):
680
661
self .store_internal_segmentation (
681
662
internal_segmentation = InternalSegmentation (
682
663
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
683
- segmentation_input_path = input .input_path ,
664
+ segmentation_input_path = i .input_path ,
684
665
params_for_storing = self .preprocessor_input .storing_params ,
685
666
downsampling_parameters = self .preprocessor_input .downsampling ,
686
667
entry_data = self .preprocessor_input .entry_data ,
@@ -689,11 +670,11 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
689
670
tasks .append (
690
671
ProcessGeometricSegmentationTask (self .get_internal_segmentation ())
691
672
)
692
- elif isinstance (input , OMETIFFImageInput ):
673
+ elif isinstance (i , OMETIFFImageInput ):
693
674
self .store_internal_volume (
694
675
internal_volume = InternalVolume (
695
676
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
696
- volume_input_path = input .input_path ,
677
+ volume_input_path = i .input_path ,
697
678
params_for_storing = self .preprocessor_input .storing_params ,
698
679
volume_force_dtype = self .preprocessor_input .volume .force_volume_dtype ,
699
680
quantize_dtype_str = self .preprocessor_input .volume .quantize_dtype_str ,
@@ -718,11 +699,11 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
718
699
internal_volume = self .get_internal_volume ()
719
700
)
720
701
)
721
- elif isinstance (input , OMETIFFSegmentationInput ):
702
+ elif isinstance (i , OMETIFFSegmentationInput ):
722
703
self .store_internal_segmentation (
723
704
internal_segmentation = InternalSegmentation (
724
705
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
725
- segmentation_input_path = input .input_path ,
706
+ segmentation_input_path = i .input_path ,
726
707
params_for_storing = self .preprocessor_input .storing_params ,
727
708
downsampling_parameters = self .preprocessor_input .downsampling ,
728
709
entry_data = self .preprocessor_input .entry_data ,
@@ -741,11 +722,11 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
741
722
internal_segmentation = self .get_internal_segmentation ()
742
723
)
743
724
)
744
- elif isinstance (input , NIIVolumeInput ):
725
+ elif isinstance (i , NIIVolumeInput ):
745
726
self .store_internal_volume (
746
727
internal_volume = InternalVolume (
747
728
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
748
- volume_input_path = input .input_path ,
729
+ volume_input_path = i .input_path ,
749
730
params_for_storing = self .preprocessor_input .storing_params ,
750
731
volume_force_dtype = self .preprocessor_input .volume .force_volume_dtype ,
751
732
quantize_dtype_str = self .preprocessor_input .volume .quantize_dtype_str ,
@@ -763,31 +744,12 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
763
744
)
764
745
)
765
746
766
- elif isinstance (input , NIISegmentationInput ):
767
- nii_segmentation_inputs .append (input )
768
- # self.store_internal_segmentation(
769
- # internal_segmentation=InternalSegmentation(
770
- # intermediate_zarr_structure_path=self.intermediate_zarr_structure,
771
- # segmentation_input_path=input.input_path,
772
- # params_for_storing=self.preprocessor_input.storing_params,
773
- # downsampling_parameters=self.preprocessor_input.downsampling,
774
- # entry_data=self.preprocessor_input.entry_data,
775
- # )
776
- # )
777
- # tasks.append(
778
- # NIIProcessSegmentationTask(
779
- # internal_segmentation=self.get_internal_segmentation()
780
- # )
781
- # )
782
- # tasks.append(
783
- # NIISegmentationMetadataCollectionTask(
784
- # internal_segmentation=self.get_internal_segmentation()
785
- # )
786
- # )
787
- elif isinstance (input , CustomAnnotationsInput ):
747
+ elif isinstance (i , NIISegmentationInput ):
748
+ nii_segmentation_inputs .append (i )
749
+ elif isinstance (i , CustomAnnotationsInput ):
788
750
tasks .append (
789
751
CustomAnnotationsCollectionTask (
790
- input_path = input .input_path ,
752
+ input_path = i .input_path ,
791
753
intermediate_zarr_structure_path = self .intermediate_zarr_structure ,
792
754
)
793
755
)
@@ -854,7 +816,7 @@ def _process_inputs(self, inputs: list[InputT]) -> list[TaskBase]:
854
816
)
855
817
)
856
818
857
- if any (isinstance (input , GeometricSegmentationInput ) for input in inputs ):
819
+ if any (isinstance (i , GeometricSegmentationInput ) for i in inputs ):
858
820
# tasks.append(SaveGeometricSegmentationSets(self.intermediate_zarr_structure))
859
821
tasks .append (
860
822
GeometricSegmentationAnnotationsCollectionTask (
@@ -876,10 +838,17 @@ def _execute_tasks(self, tasks: list[TaskBase]):
876
838
for task in tasks :
877
839
task .execute ()
878
840
841
+ def __check_if_inputs_exists (self , raw_inputs_list : list [tuple [Path , InputKind ]]):
842
+ for input_item in raw_inputs_list :
843
+ p = input_item [0 ]
844
+ assert p .exists (), f'Input file { p } does not exist'
845
+
879
846
def _analyse_preprocessor_input (self ) -> list [InputT ]:
880
847
raw_inputs_list = self .preprocessor_input .inputs .files
881
848
analyzed_inputs : list [InputT ] = []
882
849
850
+ self .__check_if_inputs_exists (raw_inputs_list )
851
+
883
852
for input_item in raw_inputs_list :
884
853
if input_item [1 ] == InputKind .extra_data :
885
854
analyzed_inputs .append (ExtraDataInput (input_path = input_item [0 ]))
0 commit comments