@@ -318,6 +318,7 @@ private static async Task ProcessAllFiles(object workerParamsObject)
318
318
}
319
319
}
320
320
321
+ // NOTE this fails with some files? returns 0,0,0 for some reason
321
322
// find lowest bounds from boundsListTemp
322
323
float lowestX = float . MaxValue ;
323
324
float lowestY = float . MaxValue ;
@@ -861,6 +862,9 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
861
862
862
863
int checkCancelEvery = fullPointCount / 128 ;
863
864
865
+ // detect is 0-255 or 0-65535 range
866
+ bool isCustomIntensityRange = false ;
867
+
864
868
// Loop all points
865
869
// FIXME: would be nicer, if use different STEP value for skip, keep and limit..(to collect points all over the file, not just start)
866
870
int maxPointIterations = importSettings . useLimit ? pointCount : fullPointCount ;
@@ -938,22 +942,27 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
938
942
}
939
943
}
940
944
941
- byte intensity = 0 ;
945
+ ushort intensity = 0 ;
942
946
byte classification = 0 ;
943
947
double time = 0 ;
944
948
945
949
// TODO get intensity as separate value
946
950
if ( importSettings . importIntensity == true )
947
951
{
948
952
intensity = taskReader . GetIntensity ( ) ;
949
- // works here
950
- //intensity = taskReader.GetClassification();
953
+
951
954
//if (i < 20000) Log.Write("int: " + intensity);
952
955
953
- // if no rgb, then replace RGB with intensity
956
+ if ( importSettings . detectIntensityRange && isCustomIntensityRange == false )
957
+ {
958
+ // check if intensity is 0-255 or 0-65535
959
+ isCustomIntensityRange = intensity > 255 ;
960
+ }
961
+
962
+ // if no rgb, then replace RGB with intensity, NOTE this doesnt work correctly if using detect intensity range! (since raw value is now ushort, can be 0-65k)
954
963
if ( importSettings . importRGB == false )
955
964
{
956
- rgb . r = intensity / 255f ;
965
+ rgb . r = intensity / 255f ; // convert byte to float
957
966
rgb . g = rgb . r ;
958
967
rgb . b = rgb . r ;
959
968
}
@@ -1009,6 +1018,11 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
1009
1018
// hack for missing 100% progress
1010
1019
progressInfo . CurrentValue = maxPointIterations ;
1011
1020
1021
+ if ( importSettings . detectIntensityRange == true )
1022
+ {
1023
+ taskWriter . SetIntensityRange ( isCustomIntensityRange ) ;
1024
+ }
1025
+
1012
1026
lastStatusMessage = "Saving files.." ;
1013
1027
//importSettings.writer.Save(fileIndex);
1014
1028
taskWriter . Save ( fileIndex ) ;
@@ -1187,6 +1201,7 @@ void StartProcess(bool doProcess = true)
1187
1201
if ( isGLTF == true ) args . Add ( ( "-usegrid=" + ( bool ) chkUseGrid . IsChecked ) . ToLower ( ) ) ;
1188
1202
1189
1203
if ( ( ( bool ) chkImportIntensity . IsChecked ) && ( ( bool ) chkCustomIntensityRange . IsChecked ) ) args . Add ( "-customintensityrange=True" ) ;
1204
+ if ( ( ( bool ) chkDetectIntensityRange . IsChecked ) && ( ( bool ) chkDetectIntensityRange . IsChecked ) ) args . Add ( "-detectintensityrange=True" ) ;
1190
1205
1191
1206
// check input files
1192
1207
//Trace.WriteLine("loggeris:" + Log.GetType().ToString());
@@ -1583,6 +1598,7 @@ private void LoadSettings()
1583
1598
txtMaxFileCount . Text = Properties . Settings . Default . maxFileCount . ToString ( ) ;
1584
1599
chkRandomize . IsChecked = Properties . Settings . Default . randomize ;
1585
1600
chkCustomIntensityRange . IsChecked = Properties . Settings . Default . customintensityrange ;
1601
+ chkDetectIntensityRange . IsChecked = Properties . Settings . Default . detectIntensityRange ;
1586
1602
chkOpenOutputFolder . IsChecked = Properties . Settings . Default . openOutputFolder ;
1587
1603
chkManualOffset . IsChecked = Properties . Settings . Default . useManualOffset ;
1588
1604
txtOffsetX . Text = Properties . Settings . Default . manualOffsetX . ToString ( ) ;
@@ -1631,6 +1647,7 @@ void SaveSettings()
1631
1647
Properties . Settings . Default . maxFileCount = Tools . ParseInt ( txtMaxFileCount . Text ) ;
1632
1648
Properties . Settings . Default . randomize = ( bool ) chkRandomize . IsChecked ;
1633
1649
Properties . Settings . Default . customintensityrange = ( bool ) chkCustomIntensityRange . IsChecked ;
1650
+ Properties . Settings . Default . detectIntensityRange = ( bool ) chkDetectIntensityRange . IsChecked ;
1634
1651
Properties . Settings . Default . openOutputFolder = ( bool ) chkOpenOutputFolder . IsChecked ;
1635
1652
Properties . Settings . Default . useManualOffset = ( bool ) chkManualOffset . IsChecked ;
1636
1653
float . TryParse ( txtOffsetX . Text . Replace ( "," , "." ) , NumberStyles . Float , CultureInfo . InvariantCulture , out float offsetX ) ;
0 commit comments