@@ -29,7 +29,7 @@ namespace PointCloudConverter
2929{
3030 public partial class MainWindow : Window
3131 {
32- static readonly string version = "29.03 .2025" ;
32+ static readonly string version = "03.04 .2025" ;
3333 static readonly string appname = "PointCloud Converter - " + version ;
3434 static readonly string rootFolder = AppDomain . CurrentDomain . BaseDirectory ;
3535
@@ -70,6 +70,10 @@ public partial class MainWindow : Window
7070 private readonly float cellSize = 0.5f ;
7171 private static ConcurrentDictionary < ( int , int , int ) , byte > occupiedCells = new ( ) ;
7272
73+ // classification stats
74+ static byte minClass = 255 ;
75+ static byte maxClass = 0 ;
76+
7377 // plugins
7478 string externalFileFormats = "" ;
7579
@@ -198,6 +202,10 @@ private async void Main()
198202 // get elapsed time using time
199203 var startTime = DateTime . Now ;
200204
205+ // classification minmax
206+ minClass = 255 ;
207+ maxClass = 0 ;
208+
201209 // if have files, process them
202210 if ( importSettings . errors . Count == 0 )
203211 {
@@ -448,6 +456,7 @@ private static async Task ProcessAllFiles(object workerParamsObject)
448456 }
449457 else
450458 {
459+ Log . Write ( "files" + importSettings . inputFiles . Count + " i:" + i ) ;
451460 Log . Write ( "Error> Failed to parse file: " + importSettings . inputFiles [ i ] , LogEvent . Error ) ;
452461 }
453462 }
@@ -752,12 +761,6 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
752761 return false ;
753762 }
754763
755- if ( importSettings . importMetadata == true )
756- {
757- var metaData = taskReader . GetMetaData ( importSettings , fileIndex ) ;
758- lasHeaders . Add ( metaData ) ;
759- }
760-
761764 if ( importSettings . importMetadataOnly == false )
762765 {
763766 int fullPointCount = taskReader . GetPointCount ( ) ;
@@ -945,7 +948,7 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
945948 // if no rgb, then replace RGB with intensity
946949 if ( importSettings . importRGB == false )
947950 {
948- rgb . r = intensity / 255f ;
951+ rgb . r = intensity / 255f ;
949952 rgb . g = rgb . r ;
950953 rgb . b = rgb . r ;
951954 }
@@ -956,10 +959,16 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
956959 if ( importSettings . importClassification == true )
957960 {
958961 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+
960969 //if (classification<0 || classification>1) Log.Write("****: " + classification.ToString());
961970
962- //if (i < 20000 ) Log.Write("class: " + classification.ToString());
971+ //if (i < 10000 ) Log.Write("class: " + classification.ToString() + " minClass: " + minClass + " maxClass: " + maxClass );
963972 //classification = 0;
964973 //if (intensity.r < minInt)
965974 //{
@@ -975,7 +984,7 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
975984 // if no rgb, then replace RGB with intensity
976985 if ( importSettings . importRGB == false )
977986 {
978- rgb . r = classification / 255f ;
987+ rgb . r = classification / 255f ;
979988 rgb . g = rgb . r ;
980989 rgb . b = rgb . r ;
981990 }
@@ -1022,7 +1031,27 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
10221031
10231032 //Log.Write(jsonString, LogEvent.File);
10241033
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+ }
10261055
10271056 //Log.Write("taskid: " + taskId + " done");
10281057 return true ;
@@ -1099,12 +1128,13 @@ void StartProcess(bool doProcess = true)
10991128 if ( inputFile . Contains ( " " ) ) inputFile = "\" " + inputFile + "\" " ;
11001129 if ( outputFile . Contains ( " " ) ) outputFile = "\" " + outputFile + "\" " ;
11011130
1102- args . Add ( "-input=" + inputFile ) ;
1103-
11041131 if ( cmbImportFormat . SelectedItem != null )
11051132 {
11061133 args . Add ( "-importformat=" + cmbImportFormat . SelectedItem . ToString ( ) ) ;
11071134 }
1135+
1136+ args . Add ( "-input=" + inputFile ) ;
1137+
11081138 if ( cmbExportFormat . SelectedItem != null )
11091139 {
11101140 args . Add ( "-exportformat=" + cmbExportFormat . SelectedItem . ToString ( ) ) ;
@@ -1386,7 +1416,27 @@ private void btnBrowseInput_Click(object sender, RoutedEventArgs e)
13861416 // select single file
13871417 var dialog = new OpenFileDialog ( ) ;
13881418 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+ }
13901440
13911441 // take folder from field
13921442 if ( string . IsNullOrEmpty ( txtInputFile . Text ) == false )
0 commit comments