Commit c7a21b7e authored by pieper's avatar pieper
Browse files

BUG: merge bug fix from slicer3 trunk for crash when certain label options...

BUG: merge bug fix from slicer3 trunk for crash when certain label options selected; also ENH: check for valid file when argument is not a slicer shared memory reference

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15634 3bd1e089-480b-0410-8dfb-8563597acbee
parent dfb3c0de
......@@ -227,7 +227,12 @@ int main(int argc, char * argv[])
int labelsMin = 0, labelsMax = 0;
// figure out if we're making multiple models
if (Labels.size() > 0)
if (GenerateAll)
{
makeMultiple = true;
if (debug) { std::cout << "GenerateAll! set make mult to true" << std::endl; }
}
else if (Labels.size() > 0)
{
if (Labels.size() == 1)
{
......@@ -247,11 +252,6 @@ int main(int argc, char * argv[])
cout << "Set labels min to " << labelsMin << ", labels max = " << labelsMax << ", labels vector size = " << Labels.size() << endl;
}
}
}
else if (GenerateAll)
{
makeMultiple = true;
if (debug) { std::cout << "GenerateAll! set make mult to true" << std::endl; }
}
else if (EndLabel >= StartLabel && (EndLabel != -1 && StartLabel != -1))
{
......@@ -313,16 +313,18 @@ int main(int argc, char * argv[])
std::cout << "useStartEnd = " << useStartEnd << ", numModelsToGenerate = "<< numModelsToGenerate << ", numFilterSteps " << numFilterSteps << endl;
}
// check for the input file
// This check doesn't work if ModelMaker InputVolume is shared with Slicer:
// slicer:0xf135d0#vtkMRMLScalarVolumeNode1
//FILE * infile;
//infile = fopen(InputVolume.c_str(),"r");
//if (infile == NULL)
// {
// std::cerr << "ERROR: cannot open input volume file " << InputVolume << endl;
// return EXIT_FAILURE;
// }
//fclose(infile);
// - strings that start with slicer:0x are shared memory references, so they won't exist
if ( InputVolume.find(std::string("slicer:0x")) != 0 )
{
FILE * infile;
infile = fopen(InputVolume.c_str(),"r");
if (infile == NULL)
{
std::cerr << "ERROR: cannot open input volume file " << InputVolume << endl;
return EXIT_FAILURE;
}
fclose(infile);
}
// Read the file
reader = vtkSmartPointer< vtkITKArchetypeImageSeriesScalarReader >::New();
......@@ -903,6 +905,11 @@ int main(int argc, char * argv[])
{
watchThreshold.QuietOn();
}
if (smoother == NULL)
{
std::cerr << "\nERROR smoothing filter is null for joint smoothing!" << std::endl;
return EXIT_FAILURE;
}
threshold->SetInput(smoother->GetOutput());
// In VTK 5.0, this is deprecated - the default behaviour seems to
// be okay
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment