File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,6 +177,16 @@ const filterCluster = async (
177177 opacityCutoff : number = 0.99 ,
178178 minContribution : number = 1 / 255
179179) : Promise < DataTable > => {
180+ if ( ! Number . isFinite ( voxelResolution ) || voxelResolution <= 0 ) {
181+ throw new Error ( `filterCluster: voxelResolution must be a positive finite number, got ${ voxelResolution } ` ) ;
182+ }
183+ if ( ! Number . isFinite ( opacityCutoff ) || opacityCutoff < 0 || opacityCutoff > 1 ) {
184+ throw new Error ( `filterCluster: opacityCutoff must be a finite number in [0, 1], got ${ opacityCutoff } ` ) ;
185+ }
186+ if ( ! Number . isFinite ( minContribution ) || minContribution < 0 ) {
187+ throw new Error ( `filterCluster: minContribution must be a non-negative finite number, got ${ minContribution } ` ) ;
188+ }
189+
180190 const numRows = dataTable . numRows ;
181191 if ( numRows === 0 ) return dataTable ;
182192
Original file line number Diff line number Diff line change @@ -36,6 +36,16 @@ const filterFloaters = async (
3636 opacityCutoff : number = 0.1 ,
3737 minContribution : number = 1 / 255
3838) : Promise < DataTable > => {
39+ if ( ! Number . isFinite ( voxelResolution ) || voxelResolution <= 0 ) {
40+ throw new Error ( `filterFloaters: voxelResolution must be a positive finite number, got ${ voxelResolution } ` ) ;
41+ }
42+ if ( ! Number . isFinite ( opacityCutoff ) || opacityCutoff < 0 || opacityCutoff > 1 ) {
43+ throw new Error ( `filterFloaters: opacityCutoff must be a finite number in [0, 1], got ${ opacityCutoff } ` ) ;
44+ }
45+ if ( ! Number . isFinite ( minContribution ) || minContribution < 0 ) {
46+ throw new Error ( `filterFloaters: minContribution must be a non-negative finite number, got ${ minContribution } ` ) ;
47+ }
48+
3949 const numRows = dataTable . numRows ;
4050 if ( numRows === 0 ) return dataTable ;
4151
Original file line number Diff line number Diff line change @@ -38,6 +38,12 @@ const setupVoxelFilter = async (
3838 ] ;
3939 const delta = computeWriteTransform ( dataTable . transform , Transform . IDENTITY ) ;
4040 const cols = transformColumns ( dataTable , voxelColumns , delta ) ;
41+
42+ const missing = voxelColumns . filter ( name => ! cols . has ( name ) ) ;
43+ if ( missing . length > 0 ) {
44+ throw new Error ( `setupVoxelFilter: input DataTable is missing required columns: ${ missing . join ( ', ' ) } ` ) ;
45+ }
46+
4147 const pcDataTable = new DataTable ( voxelColumns . map ( name => new Column ( name , cols . get ( name ) ! ) ) ) ;
4248
4349 const extentsResult = computeGaussianExtents ( pcDataTable ) ;
You can’t perform that action at this time.
0 commit comments