@@ -29,7 +29,7 @@ namespace PointCloudConverter
29
29
{
30
30
public partial class MainWindow : Window
31
31
{
32
- static readonly string version = "29.03 .2025" ;
32
+ static readonly string version = "03.04 .2025" ;
33
33
static readonly string appname = "PointCloud Converter - " + version ;
34
34
static readonly string rootFolder = AppDomain . CurrentDomain . BaseDirectory ;
35
35
@@ -70,6 +70,10 @@ public partial class MainWindow : Window
70
70
private readonly float cellSize = 0.5f ;
71
71
private static ConcurrentDictionary < ( int , int , int ) , byte > occupiedCells = new ( ) ;
72
72
73
+ // classification stats
74
+ static byte minClass = 255 ;
75
+ static byte maxClass = 0 ;
76
+
73
77
// plugins
74
78
string externalFileFormats = "" ;
75
79
@@ -198,6 +202,10 @@ private async void Main()
198
202
// get elapsed time using time
199
203
var startTime = DateTime . Now ;
200
204
205
+ // classification minmax
206
+ minClass = 255 ;
207
+ maxClass = 0 ;
208
+
201
209
// if have files, process them
202
210
if ( importSettings . errors . Count == 0 )
203
211
{
@@ -448,6 +456,7 @@ private static async Task ProcessAllFiles(object workerParamsObject)
448
456
}
449
457
else
450
458
{
459
+ Log . Write ( "files" + importSettings . inputFiles . Count + " i:" + i ) ;
451
460
Log . Write ( "Error> Failed to parse file: " + importSettings . inputFiles [ i ] , LogEvent . Error ) ;
452
461
}
453
462
}
@@ -752,12 +761,6 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
752
761
return false ;
753
762
}
754
763
755
- if ( importSettings . importMetadata == true )
756
- {
757
- var metaData = taskReader . GetMetaData ( importSettings , fileIndex ) ;
758
- lasHeaders . Add ( metaData ) ;
759
- }
760
-
761
764
if ( importSettings . importMetadataOnly == false )
762
765
{
763
766
int fullPointCount = taskReader . GetPointCount ( ) ;
@@ -945,7 +948,7 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
945
948
// if no rgb, then replace RGB with intensity
946
949
if ( importSettings . importRGB == false )
947
950
{
948
- rgb . r = intensity / 255f ;
951
+ rgb . r = intensity / 255f ;
949
952
rgb . g = rgb . r ;
950
953
rgb . b = rgb . r ;
951
954
}
@@ -956,10 +959,16 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
956
959
if ( importSettings . importClassification == true )
957
960
{
958
961
classification = taskReader . GetClassification ( ) ;
959
- //classification = taskReader.GetIntensity();
962
+
963
+ // get min and max
964
+ if ( classification < minClass ) minClass = classification ;
965
+ if ( classification > maxClass ) maxClass = classification ;
966
+
967
+ //classification = (byte)255;
968
+
960
969
//if (classification<0 || classification>1) Log.Write("****: " + classification.ToString());
961
970
962
- //if (i < 20000 ) Log.Write("class: " + classification.ToString());
971
+ //if (i < 10000 ) Log.Write("class: " + classification.ToString() + " minClass: " + minClass + " maxClass: " + maxClass );
963
972
//classification = 0;
964
973
//if (intensity.r < minInt)
965
974
//{
@@ -975,7 +984,7 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
975
984
// if no rgb, then replace RGB with intensity
976
985
if ( importSettings . importRGB == false )
977
986
{
978
- rgb . r = classification / 255f ;
987
+ rgb . r = classification / 255f ;
979
988
rgb . g = rgb . r ;
980
989
rgb . b = rgb . r ;
981
990
}
@@ -1022,7 +1031,27 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
1022
1031
1023
1032
//Log.Write(jsonString, LogEvent.File);
1024
1033
1025
- } // if importMetadataOnly == false
1034
+ if ( importSettings . importMetadata == true )
1035
+ {
1036
+ var metaData = taskReader . GetMetaData ( importSettings , fileIndex ) ;
1037
+ // NOTE now its added to every file..
1038
+ metaData . ConverterVersion = version ;
1039
+ metaData . MinClassification = minClass ;
1040
+ metaData . MaxClassification = maxClass ;
1041
+ lasHeaders . Add ( metaData ) ;
1042
+ }
1043
+
1044
+ } // if importMetadataOnly == false ^
1045
+ else // only metadata:
1046
+ {
1047
+ if ( importSettings . importMetadata == true )
1048
+ {
1049
+ var metaData = taskReader . GetMetaData ( importSettings , fileIndex ) ;
1050
+ // NOTE now its added to every file..
1051
+ metaData . ConverterVersion = version ;
1052
+ lasHeaders . Add ( metaData ) ;
1053
+ }
1054
+ }
1026
1055
1027
1056
//Log.Write("taskid: " + taskId + " done");
1028
1057
return true ;
@@ -1099,12 +1128,13 @@ void StartProcess(bool doProcess = true)
1099
1128
if ( inputFile . Contains ( " " ) ) inputFile = "\" " + inputFile + "\" " ;
1100
1129
if ( outputFile . Contains ( " " ) ) outputFile = "\" " + outputFile + "\" " ;
1101
1130
1102
- args . Add ( "-input=" + inputFile ) ;
1103
-
1104
1131
if ( cmbImportFormat . SelectedItem != null )
1105
1132
{
1106
1133
args . Add ( "-importformat=" + cmbImportFormat . SelectedItem . ToString ( ) ) ;
1107
1134
}
1135
+
1136
+ args . Add ( "-input=" + inputFile ) ;
1137
+
1108
1138
if ( cmbExportFormat . SelectedItem != null )
1109
1139
{
1110
1140
args . Add ( "-exportformat=" + cmbExportFormat . SelectedItem . ToString ( ) ) ;
@@ -1386,7 +1416,27 @@ private void btnBrowseInput_Click(object sender, RoutedEventArgs e)
1386
1416
// select single file
1387
1417
var dialog = new OpenFileDialog ( ) ;
1388
1418
dialog . Title = "Select file to import" ;
1389
- dialog . Filter = "LAS|*.las;*.laz" ;
1419
+
1420
+ if ( cmbImportFormat . SelectedItem != null )
1421
+ {
1422
+ var format = cmbImportFormat . SelectedItem . ToString ( ) ;
1423
+ if ( format == "LAS" || format == "LAZ" )
1424
+ {
1425
+ dialog . Filter = "LAS Files|*.las;*.laz|All Files|*.*" ;
1426
+ }
1427
+ else if ( format == "PLY" )
1428
+ {
1429
+ dialog . Filter = "PLY Files|*.ply|All Files|*.*" ;
1430
+ }
1431
+ else
1432
+ {
1433
+ dialog . Filter = "All Files|*.*" ;
1434
+ }
1435
+ }
1436
+ else
1437
+ {
1438
+ dialog . Filter = "Point Cloud Files|*.las;*.laz;*.ply|LAS Files|*.las;*.laz|PLY Files|*.ply|All Files|*.*" ;
1439
+ }
1390
1440
1391
1441
// take folder from field
1392
1442
if ( string . IsNullOrEmpty ( txtInputFile . Text ) == false )
0 commit comments