Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing trace in volBoundary2obj #317

Merged
merged 4 commits into from
Jan 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- *converters*
- volAddNoise moved to ```volumetric/```. (David Coeurjolly,
[#300](https://github.com/DGtal-team/pull/300))
- segfault fix in volBoundary2obj (David Coeurjolly,
[#317](https://github.com/DGtal-team/pull/317))

- *volumetric*
- new option to volAddNoise to extract the largest 6-connected
Expand Down
33 changes: 18 additions & 15 deletions converters/vol2obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ using namespace Z3i;

/**
@page vol2obj vol2obj
@brief Converts any volumetric file to an OBJ one. Each grid point with value between
@brief Converts any volumetric file to an OBJ one. Each grid point with value
between
[@a thresholdMin,@a thresholdMax] is exported as a unit cube.


Expand All @@ -56,17 +57,17 @@ using namespace Z3i;
@code
-h [ --help ] display this message
-i [ --input ] arg vol file (.vol, .longvol .p3d, .pgm3d and if
WITH_ITK is selected: dicom, dcm, mha, mhd)
WITH_ITK is selected: dicom, dcm, mha, mhd)
or sdp (sequence of discrete points).
-o [ --output ] arg Output OBJ filename
-m [ --thresholdMin ] arg (=0) threshold min to define binary shape
-M [ --thresholdMax ] arg (=255) threshold max to define binary shape

--rescaleInputMin arg (=0) min value used to rescale the input
intensity (to avoid basic cast into 8 bits
--rescaleInputMin arg (=0) min value used to rescale the input
intensity (to avoid basic cast into 8 bits
image).
--rescaleInputMax arg (=255) max value used to rescale the input
intensity (to avoid basic cast into 8 bits
--rescaleInputMax arg (=255) max value used to rescale the input
intensity (to avoid basic cast into 8 bits
image).
@endcode

Expand All @@ -81,14 +82,16 @@ int main( int argc, char** argv )
{
// parse command line ----------------------------------------------
po::options_description general_opt("Allowed options are: ");
general_opt.add_options()
("help,h", "display this message")
("input,i", po::value<std::string>(), "vol file (.vol, .longvol .p3d, .pgm3d and if WITH_ITK is selected: dicom, dcm, mha, mhd) or sdp (sequence of discrete points).")
("output,o", po::value<std::string>(), "Output OBJ filename" )
("thresholdMin,m", po::value<int>()->default_value(0), "threshold min to define binary shape" )
("thresholdMax,M", po::value<int>()->default_value(255), "threshold max to define binary shape" )
("rescaleInputMin", po::value<DGtal::int64_t>()->default_value(0), "min value used to rescale the input intensity (to avoid basic cast into 8 bits image).")
("rescaleInputMax", po::value<DGtal::int64_t>()->default_value(255), "max value used to rescale the input intensity (to avoid basic cast into 8 bits image).");
general_opt.add_options()( "help,h", "display this message" )
("input,i", po::value<std::string>(), "vol file (.vol, .longvol .p3d, .pgm3d and if WITH_ITK is selected: dicom, dcm, mha, mhd) or sdp (sequence of discrete points)." )
("output,o", po::value<std::string>(),
"Output OBJ filename (each grid point with value between [ @a thresholdMin, @a thresholdMax ] is exported as a unit cube ) " )
( "thresholdMin,m", po::value<int>()->default_value( 0 ),"threshold min to define binary shape" )
("thresholdMax,M", po::value<int>()->default_value( 255 ),"threshold max to define binary shape" )
("rescaleInputMin", po::value<DGtal::int64_t>()->default_value( 0 ), "min value used to rescale the input intensity (to avoid basic cast into 8 bits image)." )
( "rescaleInputMax",po::value<DGtal::int64_t>()->default_value( 255 ),
"max value used to rescale the input intensity (to avoid "
"basic cast into 8 bits image)." );

bool parseOK=true;
po::variables_map vm;
Expand Down Expand Up @@ -134,7 +137,7 @@ int main( int argc, char** argv )
{
DGtal::int64_t rescaleInputMin = vm["rescaleInputMin"].as<DGtal::int64_t>();
DGtal::int64_t rescaleInputMax = vm["rescaleInputMax"].as<DGtal::int64_t>();

typedef DGtal::functors::Rescaling<DGtal::int64_t ,unsigned char > RescalFCT;
Image image = GenericReader< Image >::importWithValueFunctor( inputFilename,RescalFCT(rescaleInputMin,
rescaleInputMax,
Expand Down
3 changes: 2 additions & 1 deletion converters/volBoundary2obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ int main( int argc, char** argv )

DGtal::int64_t rescaleInputMin = vm["rescaleInputMin"].as<DGtal::int64_t>();
DGtal::int64_t rescaleInputMax = vm["rescaleInputMax"].as<DGtal::int64_t>();


trace.beginBlock( "Loading file.." );
typedef DGtal::functors::Rescaling<DGtal::int64_t ,unsigned char > RescalFCT;
Image image = GenericReader< Image >::importWithValueFunctor( inputFilename,RescalFCT(rescaleInputMin,
rescaleInputMax,
Expand Down