Skip to content

Commit

Permalink
Make sure to re-normalize normal for proper computation
Browse files Browse the repository at this point in the history
For dataset with numerous slices, tiny approx in the slice length would
impact the result in non acceptable ways
  • Loading branch information
malaterre committed Jan 18, 2024
1 parent b4ece2d commit 625721a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/MediaStorageAndFileFormat/gdcmImageHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ static bool ComputeZSpacingFromIPP(const DataSet &ds, double &zspacing)
double normal[3];
DirectionCosines dc( cosines.data() );
dc.Cross( normal );
DirectionCosines::Normalize(normal);

// For each item
SequenceOfItems::SizeType nitems = sqi->GetNumberOfItems();
Expand Down Expand Up @@ -2027,6 +2028,7 @@ void ImageHelper::SetOriginValue(DataSet & ds, const Image & image)

double normal[3];
dc.Cross( normal );
DirectionCosines::Normalize(normal);

for(unsigned int i = 0; i < dimz; ++i )
{
Expand Down

0 comments on commit 625721a

Please sign in to comment.