phcerdan / SGEXT

Spatial Graph Extractor. Library and scripts to study graphs extracted from binary images, or to generate graphs and analyze them completely in-silico. Used at least in biopolymers simulations and vascular networks.
GNU General Public License v3.0
5 stars 2 forks source link

metadata of skeletonized image #8

Closed mjchambers closed 6 years ago

mjchambers commented 6 years ago

3D Segmented image:

NRRD0005
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: unsigned char
dimension: 3
space: right-anterior-superior
sizes: 211 272 315
space directions: (-1,-0,0) (-0,-1,-0) (0,0,1)
kinds: domain domain domain
encoding: gzip
space origin: (-52,-58,100)
measurement frame: (1,0,0) (0,1,0) (0,0,1)

Skeletonized image:

NRRD0004
# Complete NRRD file format specification at:
# http://teem.sourceforge.net/nrrd/format.html
type: unsigned char
dimension: 3
space: left-posterior-superior
sizes: 207 268 299
space directions: (1,0,0) (0,1,0) (0,0,1)
kinds: domain domain domain
encoding: raw
space origin: (1,2,14)

During skeletonization (after applying the 'thin'script), size of image and space origin change.

mjchambers commented 6 years ago

from thin script

    fs::path output_full_path = output_folder_path / fs::path(output_file_path.string() + ".nrrd");
    unsigned int foreground_value = 255;
    auto thin_image = ImageFromSet<Image>::create(thin_set, foreground_value);
    typedef itk::ImageFileWriter<Image::ITKImage> ITKImageWriter;
    typename ITKImageWriter::Pointer writer = ITKImageWriter::New();
    writer->SetFileName(output_full_path.string().c_str());
    writer->SetInput(thin_image.getITKImagePointer());
    writer->Update();
  }
phcerdan commented 6 years ago

Hi @mjchambers, #9 fixes this. I would recommend you update the repository to the latest version once this gets merged.

I have committed a few extra changes since the first version you downloaded, so a few things might have changed (for example, the thin scripts now requires a distance_map as input). Also there were some reorganization of folders, and I also changed the test frameork, but that doesn't affect you much.

Anyway, if you need some help, don't hesitate to ask me.