Skip to content
Snippets Groups Projects
Commit 19c7a320 authored by Vladimír Ulman's avatar Vladimír Ulman
Browse files

BUG: If anisotropic output is desired, instead of resampling (and fixing) the final output mask,

we better re-render it again (into the new re-sampled empty mask image).
parent 23227277
No related branches found
No related tags found
No related merge requests found
......@@ -350,7 +350,7 @@ int RenderMesh(int fileNo)
#ifdef DO_ANISOTROPIC_OUTPUT
//downsample now:
float factor[3]={1.f,1.f,0.125f};
const float factor[3]={1.f,1.f,0.125f};
i3d::Image3d<float>* tmp=NULL;
i3d::lanczos_resample(&intermediate,tmp,factor,2);
intermediate=*tmp;
......@@ -368,32 +368,26 @@ int RenderMesh(int fileNo)
texture.SaveImage(fileName);
std::cout << "exporting mask #" << fileNo << "\n\n";
std::cout << "exporting mask #" << fileNo << "\n";
sprintf(fileName,"mask_t%03d.tif",fileNo);
#ifdef DO_PHASE_II_AND_III
#ifdef DO_ANISOTROPIC_OUTPUT
//resample also the mask before exporting
//using NearestNeig. to keep the same image values
factor[0]*=mask.GetSizeX();
factor[1]*=mask.GetSizeY();
factor[2]*=mask.GetSizeZ();
texture=mask;
i3d::Resample(texture,mask,
(size_t)factor[0],
(size_t)factor[1],
(size_t)factor[2]);
//dilate the filopodia (only!) mask by 1px to compensate for subsampling... (hack...)
i3d::Dilation(mask,texture,i3d::nb3D_o18);
//combine the original cell body mask with the new extended filopodia masks
i3d::GRAY16* Fm=texture.GetFirstVoxelAddr(); //nice anisotropic filopodia
i3d::GRAY16* Bm=mask.GetFirstVoxelAddr(); //nice anisotropic cell body
i3d::GRAY16* const BmL=Bm+mask.GetImageSize(); //stop pointer
while (Bm != BmL)
{
//overlay dilated filopodia over the orig mask
*Bm=(*Fm > 100)? *Fm : *Bm; //mask val: 100 is body, 100+ are filopodia
++Fm; ++Bm;
}
//re-render (!, instead of resampling) also the mask before exporting
//new size
mask.MakeRoom(factor[0]*mask.GetSizeX(),
factor[1]*mask.GetSizeY(),
factor[2]*mask.GetSizeZ());
//new resolution
i3d::Resolution res=mask.GetResolution();
res.SetX(factor[0]*res.GetX());
res.SetY(factor[1]*res.GetY());
res.SetZ(factor[2]*res.GetZ());
mask.SetResolution(res);
//re-render
mask.GetVoxelData()=0;
mesh.RenderMask_bodyVol(mask); //full volume
mesh.RenderMask_filo(mask,0);
mesh.RenderMask_filo(mask,1);
#endif
#endif
//save the mask image
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment