Skip to content

Commit

Permalink
Fix vol2raw
Browse files Browse the repository at this point in the history
  • Loading branch information
kerautret committed May 25, 2020
1 parent 596b949 commit 79ea12a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions converters/vol2raw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ int main(int argc, char**argv)
CLI::App app;
std::string inputFileName;
std::string outputFileName {"result.raw"};

DGtal::int64_t rescaleInputMin {0};
DGtal::int64_t rescaleInputMax {255};

app.description("Convert a vol to a 8-bit raw file.\n Example: vol2raw ${DGtal}/examples/samples/lobster.vol res.raw \n");
app.add_option("-i,--input,1", inputFileName, "vol file (.vol, .longvol .p3d, .pgm3d and if WITH_ITK is selected: dicom, dcm, mha, mhd). For longvol, dicom, dcm, mha or mhd formats, the input values are linearly scaled between 0 and 255." )
->required()
Expand All @@ -115,8 +117,8 @@ int main(int argc, char**argv)
typedef ImageContainerBySTLVector<Z3i::Domain, unsigned char> MyImageC;
typedef DGtal::functors::Rescaling<DGtal::int64_t ,unsigned char > RescalFCT;
MyImageC imageC = GenericReader< MyImageC >::importWithValueFunctor( inputFileName ,RescalFCT(rescaleInputMin,
rescaleInputMax,
0, 255) );
rescaleInputMax,
0, 255) );

bool res = RawWriter< MyImageC >::exportRaw8(outputFileName, imageC);
trace.info() << "Raw export done, image dimensions: " << imageC.domain().upperBound()[0]-imageC.domain().lowerBound()[0]+1
Expand Down

0 comments on commit 79ea12a

Please sign in to comment.