Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/schema/components/imageviewer.py: 100%

61 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-15 02:12 +0000

1#!/usr/bin/env python 

2# -*- coding: utf-8 -*- 

3import logging 

4from marshmallow import Schema, fields 

5 

6logger = logging.getLogger(__name__) 

7 

8 

9class SourceMarking(Schema): 

10 markingid = fields.Int() 

11 sourceid = fields.Int() 

12 scale = fields.Dict() 

13 name = fields.Str() 

14 sizex = fields.Float() 

15 sizey = fields.Float() 

16 origin = fields.Bool() 

17 

18 

19class UpdateSourceMarking(Schema): 

20 scalelabel = fields.Str() 

21 x = fields.Int() 

22 y = fields.Int() 

23 

24 

25class ImageSourceConfig(Schema): 

26 fine_fixed = fields.Bool() 

27 allow_fixed_axes = fields.Bool() 

28 

29 

30class SourceSettings(Schema): 

31 has_fine = fields.Bool( 

32 metadata={"description": "Whether this origin has fine axes"} 

33 ) 

34 fine_fixed = fields.Bool( 

35 metadata={"description": "Whether the fine axis is fixed during movement"} 

36 ) 

37 coarse_fixed = fields.Bool( 

38 metadata={"description": "Whether the coarse axis is fixed during movement"} 

39 ) 

40 config = fields.Nested(ImageSourceConfig) 

41 

42 

43class AdditionalSourceUrl(Schema): 

44 name = fields.String() 

45 url = fields.String() 

46 scale = fields.Float() 

47 

48 

49class ImageSource(Schema): 

50 sourceid = fields.Int() 

51 

52 url = fields.String(required=True) 

53 additional_urls = fields.List(fields.Nested(AdditionalSourceUrl)) 

54 name = fields.String(required=True) 

55 type = fields.String(required=True) 

56 origin = fields.Bool() 

57 scale = fields.Float() 

58 

59 additional = fields.Dict(keys=fields.Str(), values=fields.Float()) 

60 

61 center = fields.List(fields.Float(), metadata={"length": 2}) 

62 markings = fields.Dict() 

63 reference = fields.Dict() 

64 pixelsize = fields.List(fields.Float(), metadata={"length": 2}) 

65 polylines = fields.Dict( 

66 keys=fields.Str(), 

67 values=fields.List(fields.List(fields.Float(), metadata={"length": 2})), 

68 ) 

69 

70 

71class MoveToCoords(Schema): 

72 x = fields.Int() 

73 y = fields.Int() 

74 

75 

76class MapAdditionalSchema(Schema): 

77 datacollectionid = fields.Int(required=True) 

78 scalars = fields.List(fields.Str(), required=True, metadata={"minItems": 1}) 

79 

80 

81class MapSettings(Schema): 

82 during_scan = fields.Bool( 

83 metadata={"description": "Whether to generate maps during a scan"} 

84 ) 

85 scalar_maps = fields.List( 

86 fields.Str(), 

87 metadata={"description": "List of scalars to automatically create maps from"}, 

88 ) 

89 

90 

91class MoveToReferenceSchema(Schema): 

92 moveid = fields.Str() 

93 positions = fields.Dict() 

94 

95 

96class SelectMatrixSchema(Schema): 

97 matrixid = fields.Str() 

98 

99 

100class ExportCropRegionSchema(Schema): 

101 x = fields.List(fields.Int) 

102 y = fields.List(fields.Int) 

103 

104 

105class ExportReferenceSchema(Schema): 

106 sampleactionid = fields.Int(required=True, metadata={"title": "Sample Action"}) 

107 crop = fields.Nested( 

108 ExportCropRegionSchema, metadata={"title": "Region to crop reference image to"} 

109 )