Skip to content

Commit

Permalink
Remove TSE native chunk input requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
pyushkevich committed Sep 13, 2024
1 parent aaec620 commit e00ad1f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/crashs/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,16 @@ def load_posteriors(self, template:Template):

# If the posteriors do not exist, load them from final segmentation instead
if len(self.posteriors) == 0:
if self.tse_native_chunk is None or self.final_seg is None:
if self.final_seg is None:
raise FileNotFoundError('No posteriors or final segmentation found in ASHS folder')

# Typically we want to crop the final segmentation to the final chunk but if we don't have
# that, then we use the image without cropping
c3d = Convert3D()
c3d.execute(f'{self.tse_native_chunk} {self.final_seg} -int 0 -reslice-identity -popas X')
if self.tse_native_chunk is not None:
c3d.execute(f'{self.tse_native_chunk} {self.final_seg} -int 0 -reslice-identity -popas X')
else:
c3d.execute(f'{self.final_seg} -trim 5mm -popas X')
for lab in ['wm', 'gm', 'bg']:
for v in template.get_labels_for_tissue_class(lab):
c3d.execute(f'-push X -thresh {v} {v} 1 0')
Expand Down

0 comments on commit e00ad1f

Please sign in to comment.