lithop 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +8 -0
  3. data/LICENSE +21 -0
  4. data/README.md +126 -0
  5. data/RELEASING.md +63 -0
  6. data/bin/lithop +6 -0
  7. data/docs/README.md +44 -0
  8. data/docs/artifacts.md +122 -0
  9. data/docs/bambu-studio.md +93 -0
  10. data/docs/calibration.md +126 -0
  11. data/docs/color-model.md +114 -0
  12. data/docs/command.md +182 -0
  13. data/docs/config.md +201 -0
  14. data/docs/getting-started.md +98 -0
  15. data/docs/troubleshooting.md +112 -0
  16. data/lib/lithop/calibration/export.rb +102 -0
  17. data/lib/lithop/calibration/profile.rb +127 -0
  18. data/lib/lithop/calibration/profile_measurements.rb +82 -0
  19. data/lib/lithop/calibration/recipe_selector.rb +54 -0
  20. data/lib/lithop/calibration/target.rb +135 -0
  21. data/lib/lithop/calibration/target_svg.rb +89 -0
  22. data/lib/lithop/calibration/thickness_selector.rb +35 -0
  23. data/lib/lithop/cli/calibration.rb +40 -0
  24. data/lib/lithop/cli/image_options.rb +69 -0
  25. data/lib/lithop/cli/options.rb +95 -0
  26. data/lib/lithop/cli/settings.rb +34 -0
  27. data/lib/lithop/cli.rb +102 -0
  28. data/lib/lithop/export/calibration.rb +46 -0
  29. data/lib/lithop/export/color_metadata.rb +80 -0
  30. data/lib/lithop/export/generation.rb +122 -0
  31. data/lib/lithop/export/job.rb +49 -0
  32. data/lib/lithop/export/metadata.rb +85 -0
  33. data/lib/lithop/export/planning.rb +78 -0
  34. data/lib/lithop/export/previews.rb +35 -0
  35. data/lib/lithop/export/print_readme.rb +69 -0
  36. data/lib/lithop/export/result.rb +21 -0
  37. data/lib/lithop/formats/stl.rb +60 -0
  38. data/lib/lithop/formats/three_mf/bambu_metadata.rb +105 -0
  39. data/lib/lithop/formats/three_mf/mesh.rb +55 -0
  40. data/lib/lithop/formats/three_mf/model_writer.rb +114 -0
  41. data/lib/lithop/formats/three_mf/part_writer.rb +49 -0
  42. data/lib/lithop/formats/three_mf.rb +128 -0
  43. data/lib/lithop/image/pipeline.rb +175 -0
  44. data/lib/lithop/image/placement.rb +54 -0
  45. data/lib/lithop/image/preview.rb +63 -0
  46. data/lib/lithop/image/svg_loader.rb +218 -0
  47. data/lib/lithop/instrumentation.rb +22 -0
  48. data/lib/lithop/job_directory.rb +55 -0
  49. data/lib/lithop/layer_structure.rb +134 -0
  50. data/lib/lithop/mesh/column_geometry.rb +161 -0
  51. data/lib/lithop/mesh/column_topology.rb +262 -0
  52. data/lib/lithop/mesh/geometry.rb +116 -0
  53. data/lib/lithop/mesh/validator.rb +123 -0
  54. data/lib/lithop/mesh/voxel_geometry.rb +113 -0
  55. data/lib/lithop/mesh/voxel_topology.rb +79 -0
  56. data/lib/lithop/model/filament_profile.rb +79 -0
  57. data/lib/lithop/model/material_display_map.rb +61 -0
  58. data/lib/lithop/model/material_model.rb +106 -0
  59. data/lib/lithop/model/palette.rb +101 -0
  60. data/lib/lithop/model/thickness.rb +45 -0
  61. data/lib/lithop/reference_three_mf.rb +119 -0
  62. data/lib/lithop/sampling_grid.rb +41 -0
  63. data/lib/lithop/settings.rb +295 -0
  64. data/lib/lithop/settings_file.rb +56 -0
  65. data/lib/lithop/version.rb +5 -0
  66. data/lib/lithop.rb +55 -0
  67. data/sig/lithop.rbs +291 -0
  68. metadata +155 -0
data/sig/lithop.rbs ADDED
@@ -0,0 +1,291 @@
1
+ module Lithop
2
+ VERSION: String
3
+
4
+ class Error < StandardError
5
+ end
6
+
7
+ class ConfigurationError < Error
8
+ end
9
+
10
+ class InputError < Error
11
+ end
12
+
13
+ class Settings
14
+ attr_reader layout_profile: String
15
+ attr_reader width: Numeric
16
+ attr_reader height: Numeric
17
+ attr_reader margin_top: Numeric
18
+ attr_reader margin_right: Numeric
19
+ attr_reader margin_bottom: Numeric
20
+ attr_reader margin_left: Numeric
21
+ attr_reader image_fit: String
22
+ attr_reader crop_position_x: Numeric
23
+ attr_reader crop_position_y: Numeric
24
+ attr_reader crop_scale: Numeric
25
+ attr_reader minimum_thickness: Numeric
26
+ attr_reader maximum_thickness: Numeric
27
+ attr_reader pixel_size: Numeric
28
+ attr_reader color_pixel_size: Numeric?
29
+ attr_reader grid_columns: Integer?
30
+ attr_reader grid_rows: Integer?
31
+ attr_reader first_layer_height: Numeric
32
+ attr_reader layer_height: Numeric
33
+ attr_reader base_white_layers: Integer
34
+ attr_reader top_layer_height: Numeric?
35
+ attr_reader top_white_start: Numeric?
36
+ attr_reader minimum_top_white_layers: Integer
37
+ attr_reader exact_maximum_thickness: bool
38
+ attr_reader nozzle_diameter: Numeric
39
+ attr_reader color_model: String
40
+ attr_reader color_layer_count: Integer
41
+ attr_reader pigment_order: Array[Symbol]
42
+ attr_reader bambu_project: bool
43
+ attr_reader maximum_input_pixels: Integer
44
+ attr_reader maximum_triangles: Integer
45
+ attr_reader effective_minimum_thickness: Float
46
+ attr_reader effective_maximum_thickness: Float
47
+
48
+ def initialize: (**untyped values) -> void
49
+ def columns: () -> Integer
50
+ def rows: () -> Integer
51
+ def effective_color_pixel_size: () -> Numeric
52
+ def fitted_grid?: () -> bool
53
+ def pixel_size_x: () -> Float
54
+ def pixel_size_y: () -> Float
55
+ def estimated_triangles: () -> Integer
56
+ def triangle_limit_message: (String label, Integer triangle_count) -> String
57
+ def x_boundaries: () -> Array[Numeric]
58
+ def y_boundaries: () -> Array[Numeric]
59
+ def quantize_thickness: (Numeric value) -> Float
60
+ def margin_samples: () -> Hash[Symbol, Integer]
61
+ def to_h: () -> Hash[Symbol, untyped]
62
+ end
63
+
64
+ class Palette
65
+ class Recipe < Data
66
+ attr_reader cyan: Integer
67
+ attr_reader magenta: Integer
68
+ attr_reader yellow: Integer
69
+ attr_reader white: Integer
70
+ attr_reader coverage_cmy: Array[Float]
71
+ attr_reader ordered_layers: Array[Symbol]
72
+
73
+ def layer_count: () -> Integer
74
+ def layers: () -> Array[Symbol]
75
+ def pigments: () -> Array[Symbol]
76
+ def to_h: () -> Hash[Symbol, untyped]
77
+ end
78
+
79
+ attr_reader layer_count: Integer
80
+ attr_reader pigment_order: Array[Symbol]
81
+ attr_reader recipes: Array[Recipe]
82
+
83
+ def initialize: (?layer_count: Integer, ?pigment_order: Array[Symbol]) -> void
84
+ def nearest: (Array[Numeric] cmy) -> Recipe
85
+ def display_color: (Recipe recipe) -> String
86
+ end
87
+
88
+ class MaterialModel
89
+ class Cell < Data
90
+ attr_reader height: Float
91
+ attr_reader recipe: Palette::Recipe
92
+ attr_reader materials: Array[Symbol]
93
+ end
94
+
95
+ attr_reader columns: Integer
96
+ attr_reader rows: Integer
97
+ attr_reader x_boundaries: Array[Numeric]
98
+ attr_reader y_boundaries: Array[Numeric]
99
+ attr_reader z_boundaries: Array[Float]
100
+ attr_reader cells: Array[Cell]
101
+
102
+ def initialize: (cmys: Array[Array[Numeric]], heights: Array[Numeric], settings: Settings, ?palette: Palette | Calibration::RecipeSelector, ?cell_cmys: Array[Array[Numeric]]?) -> void
103
+ def material_at: (Integer layer, Integer row, Integer column) -> Symbol?
104
+ def materials: () -> Array[Symbol]
105
+ def recipe_counts: () -> Hash[String, Integer]
106
+ def recipe_summaries: () -> Array[Hash[Symbol, untyped]]
107
+ end
108
+
109
+ module Calibration
110
+ class PatchMeasurement < Data
111
+ attr_reader patch_id: String
112
+ attr_reader recipe: Hash[String, Integer]
113
+ attr_reader height: Numeric
114
+ attr_reader transmitted_srgb: Array[Float]
115
+ attr_reader luminance: Float
116
+ end
117
+
118
+ class Target
119
+ class Patch < Data
120
+ attr_reader id: String
121
+ attr_reader kind: Symbol
122
+ attr_reader row: Integer
123
+ attr_reader column: Integer
124
+ attr_reader recipe: Palette::Recipe
125
+ attr_reader height: Float
126
+ attr_reader top_white_thickness: Float
127
+ end
128
+
129
+ attr_reader columns: Integer
130
+ attr_reader rows: Integer
131
+ attr_reader x_boundaries: Array[Float]
132
+ attr_reader y_boundaries: Array[Float]
133
+ attr_reader z_boundaries: Array[Float]
134
+ attr_reader cells: Array[MaterialModel::Cell]
135
+ attr_reader patches: Array[Patch]
136
+ attr_reader recipe_patches: Array[Patch]
137
+ attr_reader white_patches: Array[Patch]
138
+
139
+ def initialize: (settings: Settings) -> void
140
+ def material_at: (Integer layer, Integer row, Integer column) -> Symbol?
141
+ def materials: () -> Array[Symbol]
142
+ def width: () -> Float
143
+ def height: () -> Float
144
+ end
145
+
146
+ module TargetSVG
147
+ def self.write: (String path, Target target) -> Integer
148
+ def self.document: (Target target) -> String
149
+ end
150
+
151
+ class Profile
152
+ attr_reader data: Hash[String, untyped]
153
+
154
+ def self.template: (profile_id: String, settings: Settings, target: Target) -> Profile
155
+ def self.load: (String path) -> Profile
156
+ def self.structure_for: (Settings settings) -> Hash[String, untyped]
157
+ def initialize: (Hash[String, untyped] data) -> void
158
+ def write: (String path) -> Integer
159
+ def validate_for!: (Settings settings) -> bool
160
+ def profile_id: () -> String
161
+ def status: () -> String
162
+ def measurements: (String | Symbol kind) -> Array[PatchMeasurement]
163
+ def validate_complete!: () -> bool
164
+ end
165
+
166
+ class RecipeSelector
167
+ attr_reader layer_count: Integer
168
+ attr_reader pigment_order: Array[Symbol]
169
+ attr_reader recipes: Array[Palette::Recipe]
170
+
171
+ def initialize: (profile: Profile, palette: Palette) -> void
172
+ def nearest: (Array[Numeric] cmy) -> Palette::Recipe
173
+ end
174
+
175
+ class ThicknessSelector
176
+ def initialize: (profile: Profile, settings: Settings) -> void
177
+ def call: (Array[Numeric] densities) -> Array[Float]
178
+ end
179
+
180
+ class Export
181
+ class Result < Data
182
+ attr_reader job_id: String
183
+ attr_reader path: String
184
+ attr_reader files: Array[String]
185
+ attr_reader triangle_count: Integer
186
+ attr_reader patch_count: Integer
187
+ end
188
+
189
+ def initialize: (settings: Settings, project_dir: String, ?clock: untyped, ?random: untyped) -> void
190
+ def call: () -> Result
191
+ end
192
+ end
193
+
194
+ class VoxelGeometry
195
+ class Vertex < Data
196
+ attr_reader x: Numeric
197
+ attr_reader y: Numeric
198
+ attr_reader z: Numeric
199
+ attr_reader topology: untyped
200
+
201
+ def coordinates: () -> Array[Numeric]
202
+ end
203
+
204
+ def initialize: (model: MaterialModel | Calibration::Target, material: Symbol) -> void
205
+ def each_triangle: () -> Enumerable[Array[Vertex]]
206
+ def triangle_count: () -> Integer
207
+ end
208
+
209
+ module FilamentProfile
210
+ class Material < Data
211
+ attr_reader channel: Symbol
212
+ attr_reader name: String
213
+ attr_reader color_code: String
214
+ attr_reader display_color: String
215
+ attr_reader diameter_mm: Float
216
+
217
+ def to_h: () -> Hash[Symbol, untyped]
218
+ end
219
+
220
+ class Profile < Data
221
+ attr_reader id: String
222
+ attr_reader name: String
223
+ attr_reader manufacturer: String
224
+ attr_reader product_url: String
225
+ attr_reader reference_url: String
226
+ attr_reader materials: Array[Material]
227
+
228
+ def to_h: () -> Hash[Symbol, untyped]
229
+ end
230
+
231
+ class DisplaySample < Data
232
+ attr_reader cmy: Array[Float]
233
+ attr_reader density: Float
234
+ end
235
+
236
+ def self.default: () -> Profile
237
+ def self.display_sample: (Array[Float] rgb) -> DisplaySample?
238
+ def self.display_cmy: (Array[Float] rgb) -> Array[Float]?
239
+ def self.validate!: (Profile profile) -> bool
240
+ end
241
+
242
+ class ThreeMF
243
+ class Part < Data
244
+ attr_reader material: Symbol
245
+ attr_reader triangles: Enumerable[untyped]
246
+ end
247
+
248
+ class Result < Data
249
+ attr_reader vertex_count: Integer
250
+ attr_reader triangle_count: Integer
251
+ attr_reader material_count: Integer
252
+ attr_reader object_count: Integer
253
+ attr_reader triangle_counts_by_material: Hash[Symbol, Integer]
254
+ end
255
+
256
+ def self.write: (String path, parts: Array[Part], ?profile: FilamentProfile::Profile, ?instrumentation: untyped, ?settings: Settings?) -> Result
257
+ end
258
+
259
+ class ExportResult < Data
260
+ attr_reader job_id: String
261
+ attr_reader path: String
262
+ attr_reader files: Array[String]
263
+ attr_reader triangle_count: Integer
264
+ attr_reader three_mf_triangle_count: Integer
265
+ attr_reader material_count: Integer
266
+ attr_reader object_count: Integer
267
+ end
268
+
269
+ class Export
270
+ class CalibrationInput < Data
271
+ attr_reader profile: Calibration::Profile
272
+ attr_reader path: String
273
+ end
274
+
275
+ def initialize: (
276
+ settings: Settings,
277
+ project_dir: String,
278
+ ?input_settings_path: String?,
279
+ ?calibration: CalibrationInput?,
280
+ ?progress: untyped,
281
+ ?instrumentation: untyped,
282
+ ?clock: untyped,
283
+ ?random: untyped
284
+ ) -> void
285
+ def call: (String input_path) -> ExportResult
286
+ end
287
+
288
+ class CLI
289
+ def self.run: (Array[String] argv, ?out: untyped, ?err: untyped, ?cwd: String) -> Integer
290
+ end
291
+ end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lithop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ogom
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rexml
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '3.4'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '3.4'
26
+ - !ruby/object:Gem::Dependency
27
+ name: ruby-vips
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.3'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.3'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rubyzip
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.7'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.7'
54
+ description: Lithop converts JPEG, PNG, and SVG images locally into STL and multipart
55
+ CMYW 3MF models for backlit lithophane printing.
56
+ email:
57
+ - ogom@users.noreply.github.com
58
+ executables:
59
+ - lithop
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - CHANGELOG.md
64
+ - LICENSE
65
+ - README.md
66
+ - RELEASING.md
67
+ - bin/lithop
68
+ - docs/README.md
69
+ - docs/artifacts.md
70
+ - docs/bambu-studio.md
71
+ - docs/calibration.md
72
+ - docs/color-model.md
73
+ - docs/command.md
74
+ - docs/config.md
75
+ - docs/getting-started.md
76
+ - docs/troubleshooting.md
77
+ - lib/lithop.rb
78
+ - lib/lithop/calibration/export.rb
79
+ - lib/lithop/calibration/profile.rb
80
+ - lib/lithop/calibration/profile_measurements.rb
81
+ - lib/lithop/calibration/recipe_selector.rb
82
+ - lib/lithop/calibration/target.rb
83
+ - lib/lithop/calibration/target_svg.rb
84
+ - lib/lithop/calibration/thickness_selector.rb
85
+ - lib/lithop/cli.rb
86
+ - lib/lithop/cli/calibration.rb
87
+ - lib/lithop/cli/image_options.rb
88
+ - lib/lithop/cli/options.rb
89
+ - lib/lithop/cli/settings.rb
90
+ - lib/lithop/export/calibration.rb
91
+ - lib/lithop/export/color_metadata.rb
92
+ - lib/lithop/export/generation.rb
93
+ - lib/lithop/export/job.rb
94
+ - lib/lithop/export/metadata.rb
95
+ - lib/lithop/export/planning.rb
96
+ - lib/lithop/export/previews.rb
97
+ - lib/lithop/export/print_readme.rb
98
+ - lib/lithop/export/result.rb
99
+ - lib/lithop/formats/stl.rb
100
+ - lib/lithop/formats/three_mf.rb
101
+ - lib/lithop/formats/three_mf/bambu_metadata.rb
102
+ - lib/lithop/formats/three_mf/mesh.rb
103
+ - lib/lithop/formats/three_mf/model_writer.rb
104
+ - lib/lithop/formats/three_mf/part_writer.rb
105
+ - lib/lithop/image/pipeline.rb
106
+ - lib/lithop/image/placement.rb
107
+ - lib/lithop/image/preview.rb
108
+ - lib/lithop/image/svg_loader.rb
109
+ - lib/lithop/instrumentation.rb
110
+ - lib/lithop/job_directory.rb
111
+ - lib/lithop/layer_structure.rb
112
+ - lib/lithop/mesh/column_geometry.rb
113
+ - lib/lithop/mesh/column_topology.rb
114
+ - lib/lithop/mesh/geometry.rb
115
+ - lib/lithop/mesh/validator.rb
116
+ - lib/lithop/mesh/voxel_geometry.rb
117
+ - lib/lithop/mesh/voxel_topology.rb
118
+ - lib/lithop/model/filament_profile.rb
119
+ - lib/lithop/model/material_display_map.rb
120
+ - lib/lithop/model/material_model.rb
121
+ - lib/lithop/model/palette.rb
122
+ - lib/lithop/model/thickness.rb
123
+ - lib/lithop/reference_three_mf.rb
124
+ - lib/lithop/sampling_grid.rb
125
+ - lib/lithop/settings.rb
126
+ - lib/lithop/settings_file.rb
127
+ - lib/lithop/version.rb
128
+ - sig/lithop.rbs
129
+ homepage: https://github.com/ogom/lithop
130
+ licenses:
131
+ - MIT
132
+ metadata:
133
+ homepage_uri: https://github.com/ogom/lithop
134
+ source_code_uri: https://github.com/ogom/lithop/tree/main
135
+ changelog_uri: https://github.com/ogom/lithop/blob/main/CHANGELOG.md
136
+ bug_tracker_uri: https://github.com/ogom/lithop/issues
137
+ rubygems_mfa_required: 'true'
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 4.0.0
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubygems_version: 4.0.20
153
+ specification_version: 4
154
+ summary: Create CMYW lithophane models locally from images.
155
+ test_files: []