111 vol = carto::deepcopy(in);
120 T trueMin = *std::min_element( vol.
begin(), vol.
end() );
121 for(
int z = 0; z < vol.
getSizeZ(); ++z )
122 for(
int y = 0; y < vol.
getSizeY(); ++y )
123 for(
int x = 0; x < vol.
getSizeX(); ++x )
125 if( vol(x, y, z) != trueMin && vol(x, y, z) <
min )
135 std::vector<long> histo( 100, 0 );
136 double histoDelta = double(
max -
min) / 99.;
137 for(
int z = 0; z < vol.
getSizeZ(); ++z )
138 for(
int y = 0; y < vol.
getSizeY(); ++y )
139 for(
int x = 0; x < vol.
getSizeX(); ++x )
141 T val = vol(x, y, z);
143 histo[ int(
double(val -
min) / histoDelta ) ] += 1;
148 while( i99 >= 0 && (
double)
accumulate / histoSize < 1. - pct_kept )
151 max = (T)(
min + histoDelta *
double(i99));