From 5c9ecae5b99e5155220089836bccd58a18353e80 Mon Sep 17 00:00:00 2001 From: tripg Date: Mon, 3 Apr 2023 17:21:47 +0700 Subject: [PATCH] FIx RLE import indexing --- annotation_test.go | 6 +++--- pkg/nifti/voxel.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/annotation_test.go b/annotation_test.go index 62d1c5b..af79351 100644 --- a/annotation_test.go +++ b/annotation_test.go @@ -213,9 +213,9 @@ func TestSegmentation_Annotation4(t *testing.T) { assert.NoError(err) voxels := rd.GetNiiData().GetVoxels() - //voxels.FlipX() - //voxels.FlipY() - //voxels.FlipZ() + voxels.FlipX() + voxels.FlipY() + voxels.FlipZ() err = rd.GetNiiData().SetVoxelToRawVolume(voxels) assert.NoError(err) diff --git a/pkg/nifti/voxel.go b/pkg/nifti/voxel.go index 8b8435a..0e5a8cb 100644 --- a/pkg/nifti/voxel.go +++ b/pkg/nifti/voxel.go @@ -226,7 +226,7 @@ func (v *Voxels) ImportAsRLE() ([]SegmentRLE, error) { for idx, voxVal := range sliceData { if voxVal == key { - keyArr[idx] = key + keyArr[len(sliceData)-idx-1] = key } } encoded, err := RLEEncode(keyArr)