@@ -378,13 +378,15 @@ def dicomToCamic(annot_path, image_dimensions, output_file, source_url=None, sli
378
378
#print("prev", prevIndex, "idx", idx)
379
379
# make a thing
380
380
points = coordinates_array [prevIndex :end_idx , :]
381
- points = np .concatenate ((points , [points [0 ]]))
381
+ polygon = np .concatenate ((points , [points [0 ]]))
382
382
#print('len(points)', len(points))
383
383
if len (points ) > 0 :
384
384
newFeature = deepcopy (featureTemplate )
385
385
if x .GraphicType == "POLYLINE" :
386
386
newFeature ['geometry' ]['type' ] = "Polyline"
387
- newFeature ['geometry' ]['coordinates' ].append (points .tolist ())
387
+ newFeature ['geometry' ]['coordinates' ].append (points .tolist ())
388
+ else :
389
+ newFeature ['geometry' ]['coordinates' ].append (polygon .tolist ())
388
390
bounding_box = _makeBound (points )
389
391
# [[min_x, min_y], [min_x, max_y], [max_x, max_y], [max_x, min_y],[min_x, min_y]]
390
392
newFeature ['bound' ]['coordinates' ].append (bounding_box )
@@ -403,12 +405,14 @@ def dicomToCamic(annot_path, image_dimensions, output_file, source_url=None, sli
403
405
# and the bound
404
406
# then add the last one
405
407
points = coordinates_array [prevIndex :, :]
406
- points = np .concatenate ((points , [points [0 ]]))
408
+ polygon = np .concatenate ((points , [points [0 ]]))
407
409
if len (points ) > 0 :
408
410
newFeature = deepcopy (featureTemplate )
409
411
if x .GraphicType == "POLYLINE" :
410
412
newFeature ['geometry' ]['type' ] = "Polyline"
411
- newFeature ['geometry' ]['coordinates' ].append (points .tolist ())
413
+ newFeature ['geometry' ]['coordinates' ].append (points .tolist ())
414
+ else :
415
+ newFeature ['geometry' ]['coordinates' ].append (polygon .tolist ())
412
416
bounding_box = _makeBound (points )
413
417
# [[min_x, min_y], [min_x, max_y], [max_x, max_y], [max_x, min_y],[min_x, min_y]]
414
418
newFeature ['bound' ]['coordinates' ].append (bounding_box )
@@ -426,11 +430,13 @@ def dicomToCamic(annot_path, image_dimensions, output_file, source_url=None, sli
426
430
else :
427
431
# whole thing at once. Only do area and circumference here.
428
432
points = coordinates_array
429
- points = np .concatenate ((points , [points [0 ]]))
433
+ polygon = np .concatenate ((points , [points [0 ]]))
430
434
newFeature = deepcopy (featureTemplate )
431
435
if x .GraphicType == "POLYLINE" :
432
436
newFeature ['geometry' ]['type' ] = "Polyline"
433
- newFeature ['geometry' ]['coordinates' ].append (points .tolist ())
437
+ newFeature ['geometry' ]['coordinates' ].append (points .tolist ())
438
+ else :
439
+ newFeature ['geometry' ]['coordinates' ].append (polygon .tolist ())
434
440
bounding_box = _makeBound (points )
435
441
# [[min_x, min_y], [min_x, max_y], [max_x, max_y], [max_x, min_y],[min_x, min_y]]
436
442
newFeature ['bound' ]['coordinates' ].append (bounding_box )
0 commit comments