Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Library/Airways/PTKComputeRadiusForBranch.m
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,14 @@
% tissue
min_hu = -1024;
max_hu = 0;
min_intensity = lung_image_as_double.HounsfieldToGreyscale(min_hu);
max_intensity = lung_image_as_double.HounsfieldToGreyscale(max_hu);
try
min_intensity = lung_image_as_double.HounsfieldToGreyscale(min_hu);
max_intensity = lung_image_as_double.HounsfieldToGreyscale(max_hu);
catch
imgV = lung_image_as_double.RawImage(:);
min_intensity = max(min_hu,min(imgV));
max_intensity = min(max_hu,max(imgV));
end
interp_image = max(double(min_intensity), interp_image);
interp_image = min(double(max_intensity), interp_image);
midpoint = ceil(size(interp_image, 1)/2);
Expand Down
3 changes: 3 additions & 0 deletions Library/Airways/PTKReallocateAirwaysByLobe.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

uncertain_bronchi = start_branches.LeftUncertain;
for bonchus = uncertain_bronchi
if ~isfield(bonchus(1).GetCentrelineTree,'GlobalIndex')
continue;
end
indices = GetVoxelsForTheseBranches(bonchus, lobes);
lobe_values = lobes.RawImage(indices);
lobe_values = setdiff(lobe_values, 0);
Expand Down
6 changes: 4 additions & 2 deletions Library/Lungs/PTKSeparateAndLabelLungs.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@
num_pixels = cellfun(@numel, CC.PixelIdxList);
total_num_pixels = sum(num_pixels);
[largest_area_numpixels, largest_areas_indices] = sort(num_pixels, 'descend');

if ~isempty(trachea_top_local)

if ~isempty(trachea_top_local) && ...
length(trachea_top_local) > 1 && ...
length(size(both_lungs.RawImage)) > 2
left_region = both_lungs.RawImage(:, 1:trachea_top_local(2), :);
right_region = both_lungs.RawImage(:, trachea_top_local(2) + 1:end, :);
left_sum = sum(left_region(:));
Expand Down