23
23
#include " rapidjson/stringbuffer.h"
24
24
#include " rapidjson/writer.h"
25
25
26
+ #include " gdcmIPPSorter.h"
27
+
26
28
int main (int argc, char *argv[])
27
29
{
28
30
itk::wasm::Pipeline pipeline (" image-sets-normalization" , " Group DICOM files into image sets" , argc, argv);
@@ -35,13 +37,26 @@ int main(int argc, char *argv[])
35
37
36
38
ITK_WASM_PARSE (pipeline);
37
39
40
+ gdcm::IPPSorter ipps;
41
+
42
+ ipps.SetComputeZSpacing (true );
43
+ bool success = ipps.Sort (files);
44
+ std::cout << " success: " << success << std::endl;
45
+
46
+ std::vector<std::string> sortedFileNames = ipps.GetFilenames ();
47
+
38
48
rapidjson::Document imageSetsJson;
39
- imageSetsJson.SetObject ();
40
49
rapidjson::Document::AllocatorType &allocator = imageSetsJson.GetAllocator ();
50
+ imageSetsJson.SetObject ();
51
+
52
+ rapidjson::Value sortedFileNameArray (rapidjson::kArrayType );
53
+ for (const std::string& fileName : sortedFileNames) {
54
+ rapidjson::Value fileNameValue;
55
+ fileNameValue.SetString (fileName.c_str (), fileName.size (), allocator);
56
+ sortedFileNameArray.PushBack (fileNameValue, allocator);
57
+ }
41
58
42
- rapidjson::Value almostEqualValue;
43
- almostEqualValue.SetBool (false );
44
- imageSetsJson.AddMember (" " , almostEqualValue, allocator);
59
+ imageSetsJson.AddMember (" sortedFileNames" , sortedFileNameArray, allocator);
45
60
46
61
rapidjson::StringBuffer stringBuffer;
47
62
rapidjson::Writer<rapidjson::StringBuffer> writer (stringBuffer);
0 commit comments