From brufsc at hotmail.com Wed Nov 1 19:42:26 2017 From: brufsc at hotmail.com (bsouza) Date: Wed, 1 Nov 2017 16:42:26 -0700 (MST) Subject: [ITK] [ITK-users] Simplex Mesh Deformable Model doesn't change Message-ID: <1509579746285-0.post@n2.nabble.com> Dear itk-developers, I'm trying to use the itkDeformableSimplexMesh3D filter to make a local adjustment of a simplex mesh. The mesh that I want to deform using this filter is already initialized close to the target structure in the image. However, after playing with all parameter values of the filter, it seems that there is not significant differences between the input and output meshes. I'm reading the mesh from a file (stl or vtk extension) and I want to deform it using a brain MRI (nifiti format) image as a reference. After the filter application, the result seems to not approximate the mesh to the local structure in the image (only occurs a small smoothness of the model). I've tried to change the parameters (alpha, beta, gamma, rigidity, number of iterations) values to check if some change would occur, but the result always seems the same. I would like that deformation to be able to move the mesh to closer to the structure in the image. My code is below. Is there something wrong with my code? Why it seems that the external force has no influence in the mesh deform result? The image and the mesh I'm using in this test is available in the link below (I don't know how much time until the link expires): http://www73.zippyshare.com/v/sqQ6cgjN/file.html Here is my code: ================================================================= enum PARAMS { PROGRAM_NAME = 0, IMAGE_FILENAME, INPUT_MESH_FILENAME, OUTPUT_MESH_FILENAME, NUM_ARGS }; using namespace std; int main( int argc, char *argv[] ) { if( argc < NUM_ARGS ) { std::cerr << "\n\n"; std::cerr << "Usage: " << argv[PROGRAM_NAME] << " imageFileName inputMeshFileName ouputMeshFileName"; std::cerr << "\n\n"; return 1; } itk::STLMeshIOFactory::RegisterOneFactory(); const int dimension = 3; typedef float PixelType; typedef itk::Image ImageType; typedef itk::DefaultDynamicMeshTraits TriangleMeshTraits; typedef itk::DefaultDynamicMeshTraits SimplexMeshTraits; typedef itk::Mesh TriangleMeshType; typedef itk::SimplexMesh SimplexMeshType; typedef itk::TriangleMeshToSimplexMeshFilter TriangleToSimplexFilterType; typedef itk::SimplexMeshToTriangleMeshFilter SimplexToTriangleFilterType; typedef itk::DeformableSimplexMesh3DFilter DeformFilterType; typedef DeformFilterType::GradientImageType GradientType; typedef itk::GradientAnisotropicDiffusionImageFilter DiffusionFilterType; typedef itk::GradientAnisotropicDiffusionImageFilter < ImageType, ImageType > GradientAnisotropicImageType; typedef itk::GradientMagnitudeRecursiveGaussianImageFilter < ImageType, ImageType > GradientMagnitudeType; typedef itk::SigmoidImageFilter< ImageType, ImageType > SigmoidImageType; typedef itk::GradientRecursiveGaussianImageFilter GradientFilterType; typedef itk::ImageFileReader ImageReaderType; typedef itk::ImageFileWriter ImageWriterType; typedef itk::MeshFileReader MeshReaderType; typedef itk::MeshFileWriter MeshWriterType; ImageReaderType::Pointer imageReader = ImageReaderType::New(); imageReader->SetFileName(argv[IMAGE_FILENAME]); imageReader->Update(); MeshReaderType::Pointer meshReader = MeshReaderType::New(); meshReader->SetFileName(argv[INPUT_MESH_FILENAME]); meshReader->Update(); std::cout << " starting to Filter Image" << std::endl; GradientAnisotropicImageType::Pointer gradientanisotropicfilter = GradientAnisotropicImageType::New(); gradientanisotropicfilter->SetInput(imageReader->GetOutput()); gradientanisotropicfilter->SetNumberOfIterations(5); gradientanisotropicfilter->SetTimeStep(0.0625); gradientanisotropicfilter->SetConductanceParameter(3); gradientanisotropicfilter->Update(); std::cout << "GradientAnisotropicDiffusion is DONE!" << std::endl; GradientMagnitudeType::Pointer gradientmagnitudefilter = GradientMagnitudeType::New(); gradientmagnitudefilter->SetInput( gradientanisotropicfilter->GetOutput() ); gradientmagnitudefilter->SetSigma(1.0); gradientmagnitudefilter->Update(); std::cout << "GradientMagnitude is DONE!" << std::endl; SigmoidImageType::Pointer sigmoidimagefilter = SigmoidImageType::New(); sigmoidimagefilter->SetInput( gradientmagnitudefilter->GetOutput()); sigmoidimagefilter->SetOutputMinimum(0); sigmoidimagefilter->SetOutputMaximum(1); sigmoidimagefilter->SetAlpha(10); sigmoidimagefilter->SetBeta(100); sigmoidimagefilter->Update(); std::cout << "Sigmoid is DONE!" << std::endl; GradientFilterType::Pointer gradientFilter = GradientFilterType::New(); gradientFilter->SetInput( sigmoidimagefilter->GetOutput() ); gradientFilter->SetSigma(1.0); gradientFilter->Update(); std::cout << "GradientMagnitude is DONE!" << std::endl; std::cout << "Gradient filter ok\n"; TriangleToSimplexFilterType::Pointer triangleToSimplexFilter = TriangleToSimplexFilterType::New(); triangleToSimplexFilter->SetInput(meshReader->GetOutput()); triangleToSimplexFilter->Update(); GradientType::Pointer gradientImage = gradientFilter->GetOutput(); SimplexMeshType::Pointer simplexMesh = triangleToSimplexFilter->GetOutput(); DeformFilterType::Pointer deformFilter = DeformFilterType::New(); const unsigned int numberOfCycles = 100; for (unsigned int i = 0; i < numberOfCycles; i++) { // must disconnect the pipeline simplexMesh->DisconnectPipeline(); deformFilter->SetInput( simplexMesh ); deformFilter->SetGradient( gradientImage ); deformFilter->SetAlpha(0.1); deformFilter->SetBeta(-0.1); deformFilter->SetIterations(5); deformFilter->SetRigidity(1); deformFilter->Update(); } SimplexMeshType::Pointer deformResult = deformFilter->GetOutput(); SimplexToTriangleFilterType::Pointer simplexToTriangleFilter = SimplexToTriangleFilterType::New(); simplexToTriangleFilter->SetInput(deformResult); simplexToTriangleFilter->Update(); TriangleMeshType::Pointer conversionResult = simplexToTriangleFilter->GetOutput(); conversionResult->DisconnectPipeline(); MeshWriterType::Pointer meshWriter = MeshWriterType::New(); meshWriter->SetFileName(argv[OUTPUT_MESH_FILENAME]); meshWriter->SetInput(conversionResult); meshWriter->Update(); return EXIT_SUCCESS; } ================================================================= I really appreciate any help you can provide me. Thank you very much, Breno -- Sent from: http://itk-insight-users.2283740.n2.nabble.com/ The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Thu Nov 2 11:19:17 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Thu, 2 Nov 2017 11:19:17 -0400 Subject: [ITK] [ITK-users] Simplex Mesh Deformable Model doesn't change In-Reply-To: <1509579746285-0.post@n2.nabble.com> References: <1509579746285-0.post@n2.nabble.com> Message-ID: Hi Breno, can you provide a link via some service which does not require installation of some adware to download the file? I think that most could storage providers have a free version (e.g. Dropbox or Google Drive). Also, we are trying to switch to Discourse , can you re-post the message with updated link there? Regards, D?enan On Wed, Nov 1, 2017 at 7:42 PM, bsouza wrote: > Dear itk-developers, > > I'm trying to use the itkDeformableSimplexMesh3D filter to make a local > adjustment of a simplex mesh. The mesh that I want to deform using this > filter is already initialized close to the target structure in the image. > However, after playing with all parameter values of the filter, it seems > that there is not significant differences between the input and output > meshes. > > I'm reading the mesh from a file (stl or vtk extension) and I want to > deform > it using a brain MRI (nifiti format) image as a reference. After the filter > application, the result seems to not approximate the mesh to the local > structure in the image (only occurs a small smoothness of the model). I've > tried to change the parameters (alpha, beta, gamma, rigidity, number of > iterations) values to check if some change would occur, but the result > always seems the same. I would like that deformation to be able to move the > mesh to closer to the structure in the image. My code is below. Is there > something wrong with my code? Why it seems that the external force has no > influence in the mesh deform result? > > The image and the mesh I'm using in this test is available in the link > below > (I don't know how much time until the link expires): > > http://www73.zippyshare.com/v/sqQ6cgjN/file.html > > Here is my code: > > ================================================================= > enum PARAMS { > PROGRAM_NAME = 0, > IMAGE_FILENAME, > INPUT_MESH_FILENAME, > OUTPUT_MESH_FILENAME, > NUM_ARGS > }; > > > using namespace std; > > int main( int argc, char *argv[] ) > { > > if( argc < NUM_ARGS ) > { > std::cerr << "\n\n"; > std::cerr << "Usage: " << argv[PROGRAM_NAME] << " imageFileName > inputMeshFileName ouputMeshFileName"; > std::cerr << "\n\n"; > return 1; > } > > itk::STLMeshIOFactory::RegisterOneFactory(); > > const int dimension = 3; > > typedef float PixelType; > typedef itk::Image ImageType; > > typedef itk::DefaultDynamicMeshTraits > TriangleMeshTraits; > typedef itk::DefaultDynamicMeshTraits > SimplexMeshTraits; > typedef itk::Mesh > TriangleMeshType; > typedef itk::SimplexMesh > SimplexMeshType; > > typedef itk::TriangleMeshToSimplexMeshFilter SimplexMeshType> TriangleToSimplexFilterType; > typedef itk::SimplexMeshToTriangleMeshFilter TriangleMeshType> SimplexToTriangleFilterType; > > typedef itk::DeformableSimplexMesh3DFilter SimplexMeshType> DeformFilterType; > typedef DeformFilterType::GradientImageType > GradientType; > > typedef itk::GradientAnisotropicDiffusionImageFilter ImageType> DiffusionFilterType; > > typedef itk::GradientAnisotropicDiffusionImageFilter < ImageType, > ImageType > GradientAnisotropicImageType; > typedef itk::GradientMagnitudeRecursiveGaussianImageFilter < ImageType, > ImageType > GradientMagnitudeType; > typedef itk::SigmoidImageFilter< ImageType, ImageType > SigmoidImageType; > typedef itk::GradientRecursiveGaussianImage > Filter > GradientFilterType; > > typedef itk::ImageFileReader ImageReaderType; > typedef itk::ImageFileWriter ImageWriterType; > typedef itk::MeshFileReader MeshReaderType; > typedef itk::MeshFileWriter MeshWriterType; > > > ImageReaderType::Pointer imageReader = ImageReaderType::New(); > imageReader->SetFileName(argv[IMAGE_FILENAME]); > imageReader->Update(); > > MeshReaderType::Pointer meshReader = MeshReaderType::New(); > meshReader->SetFileName(argv[INPUT_MESH_FILENAME]); > meshReader->Update(); > > std::cout << " starting to Filter Image" << std::endl; > GradientAnisotropicImageType::Pointer gradientanisotropicfilter = > GradientAnisotropicImageType::New(); > gradientanisotropicfilter->SetInput(imageReader->GetOutput()); > gradientanisotropicfilter->SetNumberOfIterations(5); > gradientanisotropicfilter->SetTimeStep(0.0625); > gradientanisotropicfilter->SetConductanceParameter(3); > gradientanisotropicfilter->Update(); > std::cout << "GradientAnisotropicDiffusion is DONE!" << std::endl; > > GradientMagnitudeType::Pointer gradientmagnitudefilter = > GradientMagnitudeType::New(); > gradientmagnitudefilter->SetInput( gradientanisotropicfilter-> > GetOutput() > ); > gradientmagnitudefilter->SetSigma(1.0); > gradientmagnitudefilter->Update(); > std::cout << "GradientMagnitude is DONE!" << std::endl; > > SigmoidImageType::Pointer sigmoidimagefilter = SigmoidImageType::New(); > sigmoidimagefilter->SetInput( gradientmagnitudefilter->GetOutput()); > sigmoidimagefilter->SetOutputMinimum(0); > sigmoidimagefilter->SetOutputMaximum(1); > sigmoidimagefilter->SetAlpha(10); > sigmoidimagefilter->SetBeta(100); > sigmoidimagefilter->Update(); > std::cout << "Sigmoid is DONE!" << std::endl; > > GradientFilterType::Pointer gradientFilter = GradientFilterType::New(); > gradientFilter->SetInput( sigmoidimagefilter->GetOutput() ); > gradientFilter->SetSigma(1.0); > gradientFilter->Update(); > std::cout << "GradientMagnitude is DONE!" << std::endl; > > std::cout << "Gradient filter ok\n"; > > TriangleToSimplexFilterType::Pointer triangleToSimplexFilter = > TriangleToSimplexFilterType::New(); > triangleToSimplexFilter->SetInput(meshReader->GetOutput()); > triangleToSimplexFilter->Update(); > > GradientType::Pointer gradientImage = gradientFilter->GetOutput(); > SimplexMeshType::Pointer simplexMesh = > triangleToSimplexFilter->GetOutput(); > DeformFilterType::Pointer deformFilter = DeformFilterType::New(); > > const unsigned int numberOfCycles = 100; > > for (unsigned int i = 0; i < numberOfCycles; i++) > { > // must disconnect the pipeline > simplexMesh->DisconnectPipeline(); > deformFilter->SetInput( simplexMesh ); > deformFilter->SetGradient( gradientImage ); > deformFilter->SetAlpha(0.1); > deformFilter->SetBeta(-0.1); > deformFilter->SetIterations(5); > deformFilter->SetRigidity(1); > deformFilter->Update(); > } > SimplexMeshType::Pointer deformResult = deformFilter->GetOutput(); > > > SimplexToTriangleFilterType::Pointer simplexToTriangleFilter = > SimplexToTriangleFilterType::New(); > simplexToTriangleFilter->SetInput(deformResult); > simplexToTriangleFilter->Update(); > TriangleMeshType::Pointer conversionResult = > simplexToTriangleFilter->GetOutput(); > > conversionResult->DisconnectPipeline(); > > MeshWriterType::Pointer meshWriter = MeshWriterType::New(); > meshWriter->SetFileName(argv[OUTPUT_MESH_FILENAME]); > meshWriter->SetInput(conversionResult); > meshWriter->Update(); > > return EXIT_SUCCESS; > } > > ================================================================= > > I really appreciate any help you can provide me. > > Thank you very much, > Breno > > > > > -- > Sent from: http://itk-insight-users.2283740.n2.nabble.com/ > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From srbn.ghosh99 at gmail.com Fri Nov 3 13:56:41 2017 From: srbn.ghosh99 at gmail.com (shrabani99) Date: Fri, 3 Nov 2017 10:56:41 -0700 (MST) Subject: [ITK] [ITK-users] Writing DICOM from non-DICOM In-Reply-To: <93FF79329C2BBB4F87A133EB17807A17494165630A@backend.visus-tt.com> References: <93FF79329C2BBB4F87A133EB17807A17494165630A@backend.visus-tt.com> Message-ID: <1509731801468-0.post@n7.nabble.com> Actually for me, my images are in PNG series. So, I need to convert each PNG image in dicom image. Is there any itk code for this to do? -- Sent from: http://itk-users.7.n7.nabble.com/ The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Fri Nov 3 14:16:20 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 3 Nov 2017 14:16:20 -0400 Subject: [ITK] [ITK-users] Writing DICOM from non-DICOM In-Reply-To: <1509731801468-0.post@n7.nabble.com> References: <93FF79329C2BBB4F87A133EB17807A17494165630A@backend.visus-tt.com> <1509731801468-0.post@n7.nabble.com> Message-ID: I don't know of an example which does exactly that. But starting with the examples I mentioned, it should be mostly a simplification. Regards, D?enan On Fri, Nov 3, 2017 at 1:56 PM, shrabani99 wrote: > Actually for me, my images are in PNG series. So, I need to convert each > PNG > image in dicom image. Is there any itk code for this to do? > > > > -- > Sent from: http://itk-users.7.n7.nabble.com/ > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From c.metz at quantib.com Thu Nov 9 03:36:02 2017 From: c.metz at quantib.com (Coert Metz) Date: Thu, 9 Nov 2017 09:36:02 +0100 Subject: [ITK] GDCMImageIO Message-ID: Hi all, GDCMImageIO seems to use GDCM's default for the transfer syntax, which is an implicit one. Is there a way to make it use explicit transfer syntax? Kind regards, Coert Metz -- This message may contain confidential or privileged information. If you are not the addressee, please notify the sender and delete it from your files. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bxt161230 at utdallas.edu Fri Nov 10 02:05:36 2017 From: bxt161230 at utdallas.edu (bipul) Date: Fri, 10 Nov 2017 00:05:36 -0700 (MST) Subject: [ITK] [ITK-users] Watershed filter: vary level parameter without running update Message-ID: <1510297536805-0.post@n2.nabble.com> Hi, The documentation for the watershed filter says that /"The Level parameter can be used to create a hierarchy of output images in constant time once an initial segmentation is done. A typical scenario might go like this: For the initial execution of the filter, set the Level to the maximum saliency value that you anticipate might be of interest. Once the initial Update() of this process object has finished, the Level can be manipulated anywhere below the initial setting without triggering a full update of the segmentation mini-pipeline. All that is now be required to produce the new output is a simple relabeling of the output image."/ I was interested in knowing how to access these hierarchy of output images, once the update has been performed. Thank you. Best, Bipul Tarafdar -- Sent from: http://itk-insight-users.2283740.n2.nabble.com/ The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Fri Nov 10 09:43:01 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 10 Nov 2017 09:43:01 -0500 Subject: [ITK] [ITK-users] Watershed filter: vary level parameter without running update In-Reply-To: <1510297536805-0.post@n2.nabble.com> References: <1510297536805-0.post@n2.nabble.com> Message-ID: Hi Bipul, the way I understood that is this: watershed->SetInput(inImage); watershed->SetLevel(0.8); watershed->Update(); //the initial segmentation, slow seg8=watershed->GetOutput(); seg8->DisconnectPipeline(); //might not be needed watershed->SetLevel(0.6); watershed->Update(); //simple relabeling, quick seg6=watershed->GetOutput(); seg6->DisconnectPipeline(); //might not be needed watershed->SetLevel(0.55); watershed->Update(); //simple relabeling, quick seg55=watershed->GetOutput(); seg55->DisconnectPipeline(); //might not be needed Give it a try, and if you run into issues ask for help on the new forum , to which we are transitioning. Regards, D?enan On Fri, Nov 10, 2017 at 2:05 AM, bipul wrote: > Hi, > > The documentation for the watershed filter says that > > /"The Level parameter can be used to create a hierarchy of output images in > constant time once an initial segmentation is done. A typical scenario > might > go like this: For the initial execution of the filter, set the Level to the > maximum saliency value that you anticipate might be of interest. Once the > initial Update() of this process object has finished, the Level can be > manipulated anywhere below the initial setting without triggering a full > update of the segmentation mini-pipeline. All that is now be required to > produce the new output is a simple relabeling of the output image."/ > > I was interested in knowing how to access these hierarchy of output images, > once the update has been performed. > > Thank you. > > Best, > Bipul Tarafdar > > > > -- > Sent from: http://itk-insight-users.2283740.n2.nabble.com/ > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From swetha.bsharma at gmail.com Fri Nov 17 09:54:29 2017 From: swetha.bsharma at gmail.com (Swetha Sharma) Date: Fri, 17 Nov 2017 20:24:29 +0530 Subject: [ITK] [ITK-users] extract middle slice from dicom files Message-ID: Hi , I want to know how to get the image values from middle slice of dicom series. -swetha -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Fri Nov 17 14:25:45 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 17 Nov 2017 14:25:45 -0500 Subject: [ITK] [ITK-users] extract middle slice from dicom files In-Reply-To: References: Message-ID: Hi Swetha, the simplest, but not computationally most efficient, is to load the series as a 3D image and then access the middle slice: image3d=reader->GetOutput(); ImageType::IndexType ind=image3d->GetBufferedRegion().GetIndex(); ind[2]=image3d->GetBufferedRegion().GetSize()[2]/2; //middle slicePixel00=image3d->GetPixel(ind); Less computation, but more code would be to examine spatial position of each slice in seriesUID and then just load the one closest to the middle. We are in the process of switching to discourse , please post follow-up questions there. Regards, D?enan On Fri, Nov 17, 2017 at 9:54 AM, Swetha Sharma wrote: > Hi , > > I want to know how to get the image values from middle slice of dicom > series. > -swetha > > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From kenji.tsumura at neosoftmedical.com Sat Nov 18 16:59:33 2017 From: kenji.tsumura at neosoftmedical.com (Kenji Tsumura) Date: Sat, 18 Nov 2017 21:59:33 +0000 Subject: [ITK] Registration processing time comparison between V3 and V4 Message-ID: <10285631702C4D4CB5C4921DC143379501988346A1@neocoilexch01> Hi, I just started to learn ITK registration and noticed there is a difference in processing time between Registration V3 and V4. It took around 2.4 seconds to perform registration of 20 MRI images using V3, whereas it took around 7.2 seconds using V4. I have no idea where this difference comes from. It would be great if someone gives me an advice on how to make processing time using V4 equivalent of that of V3, as I want to use ObjectToObjectMultiMetricV4. In the past, there was a similar post, but no one gave a clear answer. I posted the source code and image data in the following URL. https://github.com/ktsumura/ITK-BSpline-Registration/tree/master I followed the following examples. https://itk.org/Wiki/ITK/Examples/Registration/ImageRegistrationMethodBSpline DeformableRegistration4.cxx. Thank you! Kenji Disclaimer: The information contained in this communication may be confidential, is intended only for the use of the recipient(s) named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dzenanz at gmail.com Mon Nov 20 09:53:37 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Mon, 20 Nov 2017 09:53:37 -0500 Subject: [ITK] Registration processing time comparison between V3 and V4 In-Reply-To: <10285631702C4D4CB5C4921DC143379501988346A1@neocoilexch01> References: <10285631702C4D4CB5C4921DC143379501988346A1@neocoilexch01> Message-ID: Hi Kenji, on Friday we discussed the need to make v4 registration faster and more flexible, partly due to Brian Eastwood's question. The quick stopgap solution would be to replace DiscreteGaussian by a faster but approximate Gaussian filter. The long-term solution would be allowing users to implement their own MultiScaleFilter which would allow them to override a number of defaults, including smoothing and whether to force downsampling step instead of doing resampling on the fly. But we haven't decided who should implement it, or when. Please post follow-up questions on Discourse . Regards, D?enan On Sat, Nov 18, 2017 at 4:59 PM, Kenji Tsumura < kenji.tsumura at neosoftmedical.com> wrote: > Hi, > > > > I just started to learn ITK registration and noticed there is a difference > in processing time between Registration V3 and V4. It took around 2.4 > seconds to perform registration of 20 MRI images using V3, whereas it took > around 7.2 seconds using V4. I have no idea where this difference comes > from. It would be great if someone gives me an advice on how to make > processing time using V4 equivalent of that of V3, as I want to use > ObjectToObjectMultiMetricV4. In the past, there was a similar post, but no > one gave a clear answer. > > > > I posted the source code and image data in the following URL. > > https://github.com/ktsumura/ITK-BSpline-Registration/tree/master > > > > I followed the following examples. > > https://itk.org/Wiki/ITK/Examples/Registration/ > ImageRegistrationMethodBSpline > > DeformableRegistration4.cxx. > > > > Thank you! > > > > Kenji > > > > > > > Disclaimer: The information contained in this communication may be > confidential, is intended only for the use of the recipient(s) named above, > and may be legally privileged. If the reader of this message is not the > intended recipient, you are hereby notified that any dissemination, > distribution, or copying of this communication, or any of its contents, is > strictly prohibited. If you have received this communication in error, > please return it to the sender immediately and delete the original message > and any copy of it from your computer system. If you have any questions > concerning this message, please contact the sender. > > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at mbfbioscience.com Mon Nov 20 14:02:37 2017 From: brian at mbfbioscience.com (Brian Eastwood) Date: Mon, 20 Nov 2017 19:02:37 +0000 Subject: [ITK] Registration processing time comparison between V3 Message-ID: <14D3864D0DE48E4994C435F2FE6034E5019481@exchange3.microbrightfield.com> Hi Kenji, As D?enan points out, I've seen similar speed differences. Sorry I missed the discussion on Friday! There are two things I found to speed things up that you could try temporarily. 1) On your metric, call UseFixedImageGradientFilterOff() and UseMovingImageGradientFilterOff(). This means image gradients will be computed on a pixel-by-pixel basis rather than over the whole image with a filter. You'll probably want to combine this with setting a small value for SetMetricSamplingPercentage() on the registration method to limit how many sample points are evaluated in the image metric. Whether this offers a speed up will probably depend on your image sizes. 2) Replace the itk::DiscreteGaussianImageFilter with itk::SmoothingRecursiveGaussianImageFilter inside the registration method code. Note that these two filters have different interfaces (e.g. standard deviation vs. variance, normalization across scales). Yes, this requires modifying ITK source, but as it's in a header file I don't think you need to recompile ITK. I found both of these options to speed up registration v4, but I think the approach D?enan outlined for the future will be much better. Regards, Brian On Sat, Nov 18, 2017 at 4:59 PM, Kenji Tsumura < kenji.tsumura at neosoftmedical.com> wrote: > Hi, > > > > I just started to learn ITK registration and noticed there is a > difference in processing time between Registration V3 and V4. It took > around 2.4 seconds to perform registration of 20 MRI images using V3, > whereas it took around 7.2 seconds using V4. I have no idea where this > difference comes from. It would be great if someone gives me an advice > on how to make processing time using V4 equivalent of that of V3, as I > want to use ObjectToObjectMultiMetricV4. In the past, there was a > similar post, but no one gave a clear answer. > > > > I posted the source code and image data in the following URL. > > https://github.com/ktsumura/ITK-BSpline-Registration/tree/master > > > > I followed the following examples. > > https://itk.org/Wiki/ITK/Examples/Registration/ > ImageRegistrationMethodBSpline > > DeformableRegistration4.cxx. > > > > Thank you! > > > > Kenji > > > > > > > Disclaimer: The information contained in this communication may be > confidential, is intended only for the use of the recipient(s) named > above, and may be legally privileged. If the reader of this message is > not the intended recipient, you are hereby notified that any > dissemination, distribution, or copying of this communication, or any > of its contents, is strictly prohibited. If you have received this > communication in error, please return it to the sender immediately and > delete the original message and any copy of it from your computer > system. If you have any questions concerning this message, please contact the sender. > > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > > -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Subject: Digest Footer The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! _______________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community ------------------------------ End of Community Digest, Vol 50, Issue 8 **************************************** From kenji.tsumura at neosoftmedical.com Mon Nov 20 15:38:33 2017 From: kenji.tsumura at neosoftmedical.com (Kenji Tsumura) Date: Mon, 20 Nov 2017 20:38:33 +0000 Subject: [ITK] Registration processing time comparison between V3 In-Reply-To: <14D3864D0DE48E4994C435F2FE6034E5019481@exchange3.microbrightfield.com> References: <14D3864D0DE48E4994C435F2FE6034E5019481@exchange3.microbrightfield.com> Message-ID: <10285631702C4D4CB5C4921DC1433795019883472F@neocoilexch01> Hi Brian and D?enan, Thank you for the comments. I will try Brian's suggestion. Kenji -----Original Message----- From: Community [mailto:community-bounces at itk.org] On Behalf Of Brian Eastwood Sent: Monday, November 20, 2017 1:03 PM To: community at itk.org Subject: Re: [ITK] Registration processing time comparison between V3 Hi Kenji, As D?enan points out, I've seen similar speed differences. Sorry I missed the discussion on Friday! There are two things I found to speed things up that you could try temporarily. 1) On your metric, call UseFixedImageGradientFilterOff() and UseMovingImageGradientFilterOff(). This means image gradients will be computed on a pixel-by-pixel basis rather than over the whole image with a filter. You'll probably want to combine this with setting a small value for SetMetricSamplingPercentage() on the registration method to limit how many sample points are evaluated in the image metric. Whether this offers a speed up will probably depend on your image sizes. 2) Replace the itk::DiscreteGaussianImageFilter with itk::SmoothingRecursiveGaussianImageFilter inside the registration method code. Note that these two filters have different interfaces (e.g. standard deviation vs. variance, normalization across scales). Yes, this requires modifying ITK source, but as it's in a header file I don't think you need to recompile ITK. I found both of these options to speed up registration v4, but I think the approach D?enan outlined for the future will be much better. Regards, Brian On Sat, Nov 18, 2017 at 4:59 PM, Kenji Tsumura < kenji.tsumura at neosoftmedical.com> wrote: > Hi, > > > > I just started to learn ITK registration and noticed there is a > difference in processing time between Registration V3 and V4. It took > around 2.4 seconds to perform registration of 20 MRI images using V3, > whereas it took around 7.2 seconds using V4. I have no idea where this > difference comes from. It would be great if someone gives me an advice > on how to make processing time using V4 equivalent of that of V3, as I > want to use ObjectToObjectMultiMetricV4. In the past, there was a > similar post, but no one gave a clear answer. > > > > I posted the source code and image data in the following URL. > > https://github.com/ktsumura/ITK-BSpline-Registration/tree/master > > > > I followed the following examples. > > https://itk.org/Wiki/ITK/Examples/Registration/ > ImageRegistrationMethodBSpline > > DeformableRegistration4.cxx. > > > > Thank you! > > > > Kenji > > > > > > > Disclaimer: The information contained in this communication may be > confidential, is intended only for the use of the recipient(s) named > above, and may be legally privileged. If the reader of this message is > not the intended recipient, you are hereby notified that any > dissemination, distribution, or copying of this communication, or any > of its contents, is strictly prohibited. If you have received this > communication in error, please return it to the sender immediately and > delete the original message and any copy of it from your computer > system. If you have any questions concerning this message, please contact the sender. > > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > > -------------- next part -------------- An HTML attachment was scrubbed... URL: ------------------------------ Subject: Digest Footer The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! _______________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community ------------------------------ End of Community Digest, Vol 50, Issue 8 **************************************** The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community Disclaimer: The information contained in this communication may be confidential, is intended only for the use of the recipient(s) named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender. From tevain at telecom-paristech.fr Mon Nov 20 17:18:09 2017 From: tevain at telecom-paristech.fr (Timothee Evain) Date: Mon, 20 Nov 2017 23:18:09 +0100 (CET) Subject: [ITK] Naming conflict ? Message-ID: <841629828.5012894.1511216289559.JavaMail.zimbra@enst.fr> Hi everyone, I made some custom graph tools, that define classes like "Arc", "Node" and "Graph" into the global scope. The whole thing works well. I was trying to integrate these tools with ITK, but including any ITK header leads to a failed compilation, with errors about "undeclared identifiers" about my custom classes. The errors vanish when I put my code into a namespace, so I was thinking of a naming conflict with some variables or classes defined by ITK into the global scope, but I'm unable to find such structures in the ITK code. Does anyone have encountered similar issues? Tim From dzenanz at gmail.com Mon Nov 20 17:41:03 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Mon, 20 Nov 2017 17:41:03 -0500 Subject: [ITK] Naming conflict ? In-Reply-To: <841629828.5012894.1511216289559.JavaMail.zimbra@enst.fr> References: <841629828.5012894.1511216289559.JavaMail.zimbra@enst.fr> Message-ID: Hi Tim, I don't remember encountering such a problem. Can you give a sample declaration of your class, and the error message about it you get when trying to include itkImage.h? Regards, D?enan On Mon, Nov 20, 2017 at 5:18 PM, Timothee Evain wrote: > Hi everyone, > > I made some custom graph tools, that define classes like "Arc", "Node" and > "Graph" into the global scope. The whole thing works well. > I was trying to integrate these tools with ITK, but including any ITK > header leads to a failed compilation, with errors about "undeclared > identifiers" about my custom classes. > The errors vanish when I put my code into a namespace, so I was thinking > of a naming conflict with some variables or classes defined by ITK into the > global scope, but I'm unable to find such structures in the ITK code. > Does anyone have encountered similar issues? > > Tim > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________________ > Community mailing list > Community at itk.org > http://public.kitware.com/mailman/listinfo/community > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tevain at telecom-paristech.fr Tue Nov 21 05:36:50 2017 From: tevain at telecom-paristech.fr (Timothee Evain) Date: Tue, 21 Nov 2017 11:36:50 +0100 (CET) Subject: [ITK] Naming conflict ? In-Reply-To: References: <841629828.5012894.1511216289559.JavaMail.zimbra@enst.fr> Message-ID: <586207980.5188156.1511260610191.JavaMail.zimbra@enst.fr> Hi D?enan! Sure, here you are : error C2061: syntax error : identifier 'Arc' 27 error C2061: syntax error : identifier 'Arc' 31 error C2143: syntax error : missing ';' before '*' 30 error C2143: syntax error : missing ';' before '*' 49 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 30 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 49 given with the following code (I haven't included the definitions has they are useless to reproduce the bug). Comment out the #include and everything is good. //////////////////////////////////////////////////////////////////////////// #include #include /* Forward declarations of Node and Arc classes since they are interdependant */ class Node; class Arc; /* CLASS : Node Class that defines a node or summit for the graph */ class Node { public: Node(); Node(unsigned int NodeID); Node(unsigned int NodeID, int NodeLabel); Node(unsigned int NodeID, int NodeLabel, std::string NodeName); virtual ~Node(); //Add an outgoing arc (27) void AddArc(Arc* OutwardArc); //Get/set the first outward arc (30) Arc* GetFirstOutwardArc(); (31) void SetFirstOutwardArc(Arc* FirstArc); //Get/set the node ID unsigned int GetNodeID(); void SetNodeID(unsigned int ID); //Get the number of arc that exit this node unsigned int GetArcCount(); //Get/set the node name std::string GetNodeName(); void SetNodeName(std::string InputName); //Get/set the node label float GetNodeLabel(); void SetNodeLabel(float InputLabel); protected: (49) Arc* m_FirstOutwardArc; unsigned int m_ArcCount; unsigned int m_NodeID; std::string m_NodeName; float m_NodeLabel; }; /* CLASS : Arc Defines a directionnal edge for graphs Each arc strictly have a starting and ending node */ class Arc { public: Arc(); Arc(Node* StartingNode, Node* EndingNode); virtual ~Arc(); //Get/set the starting node Node* GetStartNode(); void SetStartNode(Node* StartingNode); //Get/set the ending node Node* GetEndNode(); void SetEndNode(Node* EndingNode); //Get/set the next arc originating from the same node virtual Arc* GetNextArc(); virtual void SetNextArc(Arc* NextArc); protected: Node* m_StartNode; Node* m_EndNode; private: Arc* m_NextArcFromSameNode; }; Tim From dzenanz at gmail.com Tue Nov 21 09:51:39 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Tue, 21 Nov 2017 09:51:39 -0500 Subject: [ITK] Naming conflict ? In-Reply-To: <586207980.5188156.1511260610191.JavaMail.zimbra@enst.fr> References: <841629828.5012894.1511216289559.JavaMail.zimbra@enst.fr> <586207980.5188156.1511260610191.JavaMail.zimbra@enst.fr> Message-ID: Hi Tim, ITK indirectly includes windows headers, and your Arc class suffers a name clash with WINGDIAPI BOOL WINAPI *Arc*( _In_ HDC hdc, _In_ int x1, _In_ int y1, _In_ int x2, _In_ int y2, _In_ int x3, _In_ int y3, _In_ int x4, _In_ int y4); in c:\Program Files (x86)\Windows Kits\8.1\Include\um\wingdi.h, line 3612. If your declarations are enclosed in a namespace ... namespace Tim { /* Forward declarations of Node and Arc classes since they are interdependant */ class Node; class Arc; ... } ... the file compiles. We are switching to discourse , so please make future posts there. Regards, D?enan On Tue, Nov 21, 2017 at 5:36 AM, Timothee Evain wrote: > Hi D?enan! > > Sure, here you are : > error C2061: syntax error : identifier 'Arc' 27 > error C2061: syntax error : identifier 'Arc' 31 > error C2143: syntax error : missing ';' before '*' 30 > error C2143: syntax error : missing ';' before '*' 49 > error C4430: missing type specifier - int assumed. Note: C++ does not > support default-int 30 > error C4430: missing type specifier - int assumed. Note: C++ does not > support default-int 49 > > given with the following code (I haven't included the definitions has they > are useless to reproduce the bug). > Comment out the #include and everything is good. > > //////////////////////////////////////////////////////////// > //////////////// > #include > #include > > /* Forward declarations of Node and Arc classes since they are > interdependant */ > class Node; > class Arc; > > /* CLASS : Node > Class that defines a node or summit for the graph > */ > class Node > { > public: > Node(); > Node(unsigned int NodeID); > Node(unsigned int NodeID, int NodeLabel); > Node(unsigned int NodeID, int NodeLabel, std::string NodeName); > virtual ~Node(); > > //Add an outgoing arc > (27) void AddArc(Arc* OutwardArc); > > //Get/set the first outward arc > (30) Arc* GetFirstOutwardArc(); > (31) void SetFirstOutwardArc(Arc* FirstArc); > > //Get/set the node ID > unsigned int GetNodeID(); > void SetNodeID(unsigned int ID); > > //Get the number of arc that exit this node > unsigned int GetArcCount(); > > //Get/set the node name > std::string GetNodeName(); > void SetNodeName(std::string InputName); > > //Get/set the node label > float GetNodeLabel(); > void SetNodeLabel(float InputLabel); > > protected: > (49) Arc* m_FirstOutwardArc; > unsigned int m_ArcCount; > unsigned int m_NodeID; > std::string m_NodeName; > float m_NodeLabel; > }; > > /* CLASS : Arc > Defines a directionnal edge for graphs > Each arc strictly have a starting and ending node > */ > class Arc > { > public: > Arc(); > Arc(Node* StartingNode, Node* EndingNode); > virtual ~Arc(); > > //Get/set the starting node > Node* GetStartNode(); > void SetStartNode(Node* StartingNode); > > //Get/set the ending node > Node* GetEndNode(); > void SetEndNode(Node* EndingNode); > > //Get/set the next arc originating from the same node > virtual Arc* GetNextArc(); > virtual void SetNextArc(Arc* NextArc); > > protected: > Node* m_StartNode; > Node* m_EndNode; > > private: > Arc* m_NextArcFromSameNode; > > }; > > Tim > -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.a.g.pfaehler at umcg.nl Tue Nov 21 10:12:44 2017 From: e.a.g.pfaehler at umcg.nl (Pfaehler, EAG (ngmb)) Date: Tue, 21 Nov 2017 15:12:44 +0000 Subject: [ITK] [ITK-dev] Problem calculating oriented bounding box, itk::ShapeLabelObject Message-ID: Dear all, I need the size of the oriented bounding box of a mask. I created a shape label object and extracted already some attributes (like nr. of pixels etc), what works pretty fine. Now I wanted to get the size of the oriented bounding box. But whatever I do and no matter which object I use, I always get the result [0, 0, 0] Is there a trick? Thanks a lot for your answer. Regards Elli My code: typedef itk::CastImageFilter CastFilterType; typedef itk::CastImageFilter uCharCastFilterType; typedef itk::ConnectedComponentImageFilter ConnectedComponentFilterType; typedef itk::LabelImageToShapeLabelMapFilter LabelImageToShapeLabelMapFilterType; typedef int LabelType; typedef itk::ShapeLabelObject ShapeLabelObjectType; typedef itk::LabelMap LabelMapType; typename ConnectedComponentFilterType::Pointer connectedComponentImageFilter = ConnectedComponentFilterType::New(); connectedComponentImageFilter->SetInput(castFilter->GetOutput()); connectedComponentImageFilter->Update(); /*! With the label image to shape label map filter the mask is converted to a labeled image */ typename LabelImageToShapeLabelMapFilterType::Pointer labelImageToShapeLabelMapFilter = LabelImageToShapeLabelMapFilterType::New(); labelImageToShapeLabelMapFilter->SetInput(connectedComponentImageFilter->GetOutput()); labelImageToShapeLabelMapFilter->SetComputePerimeter(true); labelImageToShapeLabelMapFilter->Update(); LabelMapType *labelMap = labelImageToShapeLabelMapFilter->GetOutput(); labelMap->Update(); /*! For every connected component a labelObject is created Because we are only interested in the object with the label one, we check the label number */ for(unsigned int n = 0; n < labelMap->GetNumberOfLabelObjects(); n++){ ShapeLabelObjectType *labelObject = labelMap->GetNthLabelObject(n); int labelNr = labelObject->GetLabel(); if(labelNr ==1){ #ifdef _WIN32 volume = labelObject->GetPhysicalSize(); principalMoments = labelObject->GetPrincipalMoments(); nrPixels = labelObject->GetNumberOfPixels(); surface = labelObject->GetNumberOfPixelsOnBorder()*imageSpacingX*imageSpacingY*imageSpacingZ; std::cout << "nr Pixels border" << labelObject->GetOrientedBoundingBoxOrigin() << std::endl; ________________________________ De inhoud van dit bericht is vertrouwelijk en alleen bestemd voor de geadresseerde(n). Anderen dan de geadresseerde(n) mogen geen gebruik maken van dit bericht, het niet openbaar maken of op enige wijze verspreiden of vermenigvuldigen. Het UMCG kan niet aansprakelijk gesteld worden voor een incomplete aankomst of vertraging van dit verzonden bericht. The contents of this message are confidential and only intended for the eyes of the addressee(s). Others than the addressee(s) are not allowed to use this message, to make it public or to distribute or multiply this message in any way. The UMCG cannot be held responsible for incomplete reception or delay of this transferred message. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ______________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-developers From dzenanz at gmail.com Tue Nov 21 12:46:17 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Tue, 21 Nov 2017 12:46:17 -0500 Subject: [ITK] [ITK-dev] Problem calculating oriented bounding box, itk::ShapeLabelObject In-Reply-To: References: Message-ID: Hi Elli, can you repost on discourse ? We have moved there. Regards, D?enan On Tue, Nov 21, 2017 at 10:12 AM, Pfaehler, EAG (ngmb) < e.a.g.pfaehler at umcg.nl> wrote: > Dear all, > > I need the size of the oriented bounding box of a mask. > I created a shape label object and extracted already some attributes (like > nr. of pixels etc), what works pretty fine. > Now I wanted to get the size of the oriented bounding box. But whatever I > do and no matter which object I use, I always get the result [0, 0, 0] > Is there a trick? > > Thanks a lot for your answer. > > Regards > > Elli > > My code: > > > typedef itk::CastImageFilter CastFilterType; > typedef itk::CastImageFilter > uCharCastFilterType; > typedef itk::ConnectedComponentImageFilter > ConnectedComponentFilterType; > typedef itk::LabelImageToShapeLabelMapFilter > LabelImageToShapeLabelMapFilterType; > > typedef int LabelType; > typedef itk::ShapeLabelObject ShapeLabelObjectType; > typedef itk::LabelMap LabelMapType; > typename ConnectedComponentFilterType::Pointer > connectedComponentImageFilter = ConnectedComponentFilterType::New(); > connectedComponentImageFilter->SetInput(castFilter->GetOutput()); > connectedComponentImageFilter->Update(); > /*! > With the label image to shape label map filter the mask is converted > to a labeled image > */ > typename LabelImageToShapeLabelMapFilterType::Pointer > labelImageToShapeLabelMapFilter = LabelImageToShapeLabelMapFilte > rType::New(); > labelImageToShapeLabelMapFilter->SetInput( > connectedComponentImageFilter->GetOutput()); > labelImageToShapeLabelMapFilter->SetComputePerimeter(true); > labelImageToShapeLabelMapFilter->Update(); > > LabelMapType *labelMap = labelImageToShapeLabelMapFilter->GetOutput(); > labelMap->Update(); > /*! > For every connected component a labelObject is created > Because we are only interested in the object with the label one, we > check the label number > */ > for(unsigned int n = 0; n < labelMap->GetNumberOfLabelObjects(); n++){ > ShapeLabelObjectType *labelObject = labelMap->GetNthLabelObject(n) > ; > int labelNr = labelObject->GetLabel(); > if(labelNr ==1){ > #ifdef _WIN32 > volume = labelObject->GetPhysicalSize(); > principalMoments = labelObject->GetPrincipalMoments(); > nrPixels = labelObject->GetNumberOfPixels(); > surface = labelObject->GetNumberOfPixelsOnBorder()* > imageSpacingX*imageSpacingY*imageSpacingZ; > std::cout << "nr Pixels border" << labelObject->GetOrientedBoundingBoxOrigin() > << std::endl; > ------------------------------ > De inhoud van dit bericht is vertrouwelijk en alleen bestemd voor de > geadresseerde(n). Anderen dan de geadresseerde(n) mogen geen gebruik maken > van dit bericht, het niet openbaar maken of op enige wijze verspreiden of > vermenigvuldigen. Het UMCG kan niet aansprakelijk gesteld worden voor een > incomplete aankomst of vertraging van dit verzonden bericht. > > The contents of this message are confidential and only intended for the > eyes of the addressee(s). Others than the addressee(s) are not allowed to > use this message, to make it public or to distribute or multiply this > message in any way. The UMCG cannot be held responsible for incomplete > reception or delay of this transferred message. > > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ______________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-developers > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ______________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-developers From cyril.mory at creatis.insa-lyon.fr Wed Nov 22 04:41:35 2017 From: cyril.mory at creatis.insa-lyon.fr (Cyril Mory) Date: Wed, 22 Nov 2017 10:41:35 +0100 Subject: [ITK] [ITK-users] VariableLengthVector and multiplication Message-ID: <4740afa6-0730-728f-5a66-46cea25229ee@creatis.insa-lyon.fr> Dear ITK users, I am using itk::VectorImage in some of my code, which uses itk::VariableLengthVector as pixel type. And I am wondering why itk::VariableLengthVector has so little support for multiplication. Currently, the * operator only supports multiplication by a scalar. It probably isn't simple, but I would need three additional kinds of multiplication: - dot product with another VariableLengthVector (that has the same length, although it is probably a waste of time to perform the check every time), returning a scalar - component-wise multiplication, returning a VariableLengthVector of the same length - left or right multiplication with a matrix (possibly an itk::VariableSizeMatrix) that has the correct size, but I understand that this is probably the most complex one, and since it only occurs rarely in my code, I can handle it with conversions to vnl::vector and vnl::matrix Are there constraints that prevent at least the dot product and component-wise multiplication operators from being implemented ? If not, then I'd be happy to give it a try. Since both differ only by the return type, two different operators would have to be used (I guess). Do you have suggestions (which one should use *, and what should be the other operator) ? In itk::Vector and itk::CovariantVector, the * operator is used for dot product. Regards, Cyril The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From blowekamp at mail.nih.gov Wed Nov 22 08:38:41 2017 From: blowekamp at mail.nih.gov (Lowekamp, Bradley (NIH/NLM/LHC) [C]) Date: Wed, 22 Nov 2017 13:38:41 +0000 Subject: [ITK] [ITK-users] VariableLengthVector and multiplication In-Reply-To: <4740afa6-0730-728f-5a66-46cea25229ee@creatis.insa-lyon.fr> References: <4740afa6-0730-728f-5a66-46cea25229ee@creatis.insa-lyon.fr> Message-ID: <26BF12F6-67F6-4488-81AC-14DDA1581CC3@mail.nih.gov> Hello, There are an incredible number of different per-pixel operations that could be implemented as ITK filters. We cannot provide them all. Many of the basic operations are implemented as ITK filters these include performing the basic C++ operators, such as +, -, * and /, on a per-pixel basis. As you indicate there are many possible meanings for multiplication of vector images, which can lead to confusion. ITK has a flexible set of Unary[1], Binary[2] functor filters. Classes like the MultiplyImageFilter[3], are implemented by deriving from the base functor classes. However it is easier to just use the base functor filter and set the proper or custom functor, as in this example [4]. It is fairly easy to write a functor for your specific purposes by following the existing set [5]. It is common for filters to internally define a private functor to perform one step in a large filter. Moving from writing for loops on pixels to writing custom functors is part of good usage of ITK. Brad [1] https://itk.org/Doxygen/html/classitk_1_1UnaryFunctorImageFilter.html [2] https://itk.org/Doxygen/html/classitk_1_1BinaryFunctorImageFilter.html [3] https://itk.org/Doxygen/html/classitk_1_1MultiplyImageFilter.html [4] https://itk.org/Doxygen/html/WikiExamples_2ImageProcessing_2BinaryFunctorImageFilter_8cxx-example.html#_a1 On 11/22/17, 5:15 AM, "Cyril Mory" wrote: Dear ITK users, I am using itk::VectorImage in some of my code, which uses itk::VariableLengthVector as pixel type. And I am wondering why itk::VariableLengthVector has so little support for multiplication. Currently, the * operator only supports multiplication by a scalar. It probably isn't simple, but I would need three additional kinds of multiplication: - dot product with another VariableLengthVector (that has the same length, although it is probably a waste of time to perform the check every time), returning a scalar - component-wise multiplication, returning a VariableLengthVector of the same length - left or right multiplication with a matrix (possibly an itk::VariableSizeMatrix) that has the correct size, but I understand that this is probably the most complex one, and since it only occurs rarely in my code, I can handle it with conversions to vnl::vector and vnl::matrix Are there constraints that prevent at least the dot product and component-wise multiplication operators from being implemented ? If not, then I'd be happy to give it a try. Since both differ only by the return type, two different operators would have to be used (I guess). Do you have suggestions (which one should use *, and what should be the other operator) ? In itk::Vector and itk::CovariantVector, the * operator is used for dot product. Regards, Cyril The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From cyril.mory at creatis.insa-lyon.fr Wed Nov 22 09:54:49 2017 From: cyril.mory at creatis.insa-lyon.fr (Cyril Mory) Date: Wed, 22 Nov 2017 15:54:49 +0100 Subject: [ITK] [ITK-users] VariableLengthVector and multiplication In-Reply-To: <26BF12F6-67F6-4488-81AC-14DDA1581CC3@mail.nih.gov> References: <4740afa6-0730-728f-5a66-46cea25229ee@creatis.insa-lyon.fr> <26BF12F6-67F6-4488-81AC-14DDA1581CC3@mail.nih.gov> Message-ID: <23954cc4-a874-7213-471e-b817cab250aa@creatis.insa-lyon.fr> Thanks for this answer. I am trying the approach you suggested, and would like to write a dot product functor that would work either on scalars (in which case it would perform a simple product) or on itk::VariableLengthVector of scalars (in which case it would perform a dot product). I found the "itk::NumericTraits::GetLength()" method, which works in both cases, and so I tried this: namespace Functor { ? template< class TPixel, class TInternal> ? class DotProduct ? { ? public: ??? DotProduct() {} ??? ~DotProduct() {} ??? bool operator!=(const DotProduct &) const ??? { ????? return false; ??? } ??? bool operator==(const DotProduct & other) const ??? { ????? return !( *this != other ); ??? } ??? inline TInternal operator()(const TPixel & A, const TPixel & B) const ??? { ??? TInternal out = 0; ??? for (unsigned int component=0; component < itk::NumericTraits::GetLength(); component++) ????? { ????? out += A[component] * B[component]; ????? } ??? return out; ??? } ? }; } // end namespace functor But it does not compile with itk::Image inputs, since the pixels A and B have no [ ] operator. Is there a standard way around this problem ? Regards, Cyril On 22/11/2017 14:38, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: > Hello, > > There are an incredible number of different per-pixel operations that could be implemented as ITK filters. We cannot provide them all. Many of the basic operations are implemented as ITK filters these include performing the basic C++ operators, such as +, -, * and /, on a per-pixel basis. > > As you indicate there are many possible meanings for multiplication of vector images, which can lead to confusion. > > ITK has a flexible set of Unary[1], Binary[2] functor filters. Classes like the MultiplyImageFilter[3], are implemented by deriving from the base functor classes. However it is easier to just use the base functor filter and set the proper or custom functor, as in this example [4]. > > It is fairly easy to write a functor for your specific purposes by following the existing set [5]. It is common for filters to internally define a private functor to perform one step in a large filter. Moving from writing for loops on pixels to writing custom functors is part of good usage of ITK. > > > Brad > > > [1] https://itk.org/Doxygen/html/classitk_1_1UnaryFunctorImageFilter.html > [2] https://itk.org/Doxygen/html/classitk_1_1BinaryFunctorImageFilter.html > [3] https://itk.org/Doxygen/html/classitk_1_1MultiplyImageFilter.html > [4] https://itk.org/Doxygen/html/WikiExamples_2ImageProcessing_2BinaryFunctorImageFilter_8cxx-example.html#_a1 > > On 11/22/17, 5:15 AM, "Cyril Mory" wrote: > > Dear ITK users, > > I am using itk::VectorImage in some of my code, which uses > itk::VariableLengthVector as pixel type. And I am wondering why > itk::VariableLengthVector has so little support for multiplication. > Currently, the * operator only supports multiplication by a scalar. > > It probably isn't simple, but I would need three additional kinds of > multiplication: > > - dot product with another VariableLengthVector (that has the same > length, although it is probably a waste of time to perform the check > every time), returning a scalar > > - component-wise multiplication, returning a VariableLengthVector of the > same length > > - left or right multiplication with a matrix (possibly an > itk::VariableSizeMatrix) that has the correct size, but I understand > that this is probably the most complex one, and since it only occurs > rarely in my code, I can handle it with conversions to vnl::vector and > vnl::matrix > > Are there constraints that prevent at least the dot product and > component-wise multiplication operators from being implemented ? If not, > then I'd be happy to give it a try. Since both differ only by the return > type, two different operators would have to be used (I guess). Do you > have suggestions (which one should use *, and what should be the other > operator) ? In itk::Vector and itk::CovariantVector, the * operator is > used for dot product. > > Regards, > > Cyril > > > The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > > > The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Wed Nov 22 10:17:15 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 22 Nov 2017 10:17:15 -0500 Subject: [ITK] [ITK-users] VariableLengthVector and multiplication In-Reply-To: <23954cc4-a874-7213-471e-b817cab250aa@creatis.insa-lyon.fr> References: <4740afa6-0730-728f-5a66-46cea25229ee@creatis.insa-lyon.fr> <26BF12F6-67F6-4488-81AC-14DDA1581CC3@mail.nih.gov> <23954cc4-a874-7213-471e-b817cab250aa@creatis.insa-lyon.fr> Message-ID: Hi Cyril, Francois has recently used compileif construct. That might help you. But I can't find an instance of it right now. Also, we are moving to discourse . Please post follow-ups there. Regards, D?enan On Wed, Nov 22, 2017 at 9:54 AM, Cyril Mory wrote: > Thanks for this answer. > > I am trying the approach you suggested, and would like to write a dot > product functor that would work either on scalars (in which case it would > perform a simple product) or on itk::VariableLengthVector of scalars (in > which case it would perform a dot product). > > I found the "itk::NumericTraits::GetLength()" method, which works > in both cases, and so I tried this: > > > namespace Functor > { > template< class TPixel, class TInternal> > class DotProduct > { > public: > DotProduct() {} > ~DotProduct() {} > bool operator!=(const DotProduct &) const > { > return false; > } > > bool operator==(const DotProduct & other) const > { > return !( *this != other ); > } > > inline TInternal operator()(const TPixel & A, const TPixel & B) const > { > TInternal out = 0; > for (unsigned int component=0; component < > itk::NumericTraits::GetLength(); component++) > { > out += A[component] * B[component]; > } > return out; > } > }; > } // end namespace functor > > > But it does not compile with itk::Image inputs, since the pixels A and B > have no [ ] operator. Is there a standard way around this problem ? > > Regards, > Cyril > > > On 22/11/2017 14:38, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: > >> Hello, >> >> There are an incredible number of different per-pixel operations that >> could be implemented as ITK filters. We cannot provide them all. Many of >> the basic operations are implemented as ITK filters these include >> performing the basic C++ operators, such as +, -, * and /, on a per-pixel >> basis. >> >> As you indicate there are many possible meanings for multiplication of >> vector images, which can lead to confusion. >> >> ITK has a flexible set of Unary[1], Binary[2] functor filters. Classes >> like the MultiplyImageFilter[3], are implemented by deriving from the base >> functor classes. However it is easier to just use the base functor filter >> and set the proper or custom functor, as in this example [4]. >> >> It is fairly easy to write a functor for your specific purposes by >> following the existing set [5]. It is common for filters to internally >> define a private functor to perform one step in a large filter. Moving from >> writing for loops on pixels to writing custom functors is part of good >> usage of ITK. >> >> >> Brad >> >> >> [1] https://itk.org/Doxygen/html/classitk_1_1UnaryFunctorImageFilter.html >> [2] https://itk.org/Doxygen/html/classitk_1_1BinaryFunctorImageF >> ilter.html >> [3] https://itk.org/Doxygen/html/classitk_1_1MultiplyImageFilter.html >> [4] https://itk.org/Doxygen/html/WikiExamples_2ImageProcessing_2 >> BinaryFunctorImageFilter_8cxx-example.html#_a1 >> >> On 11/22/17, 5:15 AM, "Cyril Mory" >> wrote: >> >> Dear ITK users, >> I am using itk::VectorImage in some of my code, which uses >> itk::VariableLengthVector as pixel type. And I am wondering why >> itk::VariableLengthVector has so little support for multiplication. >> Currently, the * operator only supports multiplication by a scalar. >> It probably isn't simple, but I would need three additional >> kinds of >> multiplication: >> - dot product with another VariableLengthVector (that has the >> same >> length, although it is probably a waste of time to perform the check >> every time), returning a scalar >> - component-wise multiplication, returning a >> VariableLengthVector of the >> same length >> - left or right multiplication with a matrix (possibly an >> itk::VariableSizeMatrix) that has the correct size, but I understand >> that this is probably the most complex one, and since it only occurs >> rarely in my code, I can handle it with conversions to vnl::vector >> and >> vnl::matrix >> Are there constraints that prevent at least the dot product and >> component-wise multiplication operators from being implemented ? If >> not, >> then I'd be happy to give it a try. Since both differ only by the >> return >> type, two different operators would have to be used (I guess). Do you >> have suggestions (which one should use *, and what should be the >> other >> operator) ? In itk::Vector and itk::CovariantVector, the * operator >> is >> used for dot product. >> Regards, >> Cyril >> The ITK community is transitioning from this mailing list >> to discourse.itk.org. Please join us there! >> ________________________________ >> Powered by www.kitware.com >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> Kitware offers ITK Training Courses, for more information visit: >> http://www.kitware.com/products/protraining.php >> Please keep messages on-topic and check the ITK FAQ at: >> http://www.itk.org/Wiki/ITK_FAQ >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/insight-users >> >> >> > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Wed Nov 22 12:42:44 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Wed, 22 Nov 2017 12:42:44 -0500 Subject: [ITK] [ITK-users] VariableLengthVector and multiplication In-Reply-To: References: <4740afa6-0730-728f-5a66-46cea25229ee@creatis.insa-lyon.fr> <26BF12F6-67F6-4488-81AC-14DDA1581CC3@mail.nih.gov> <23954cc4-a874-7213-471e-b817cab250aa@creatis.insa-lyon.fr> Message-ID: I found it. Construct is called *EnableIf*, and you can see how it is used in *ITK\Modules\Core\Common\test\itkEnableIfTest.cxx* Regards On Wed, Nov 22, 2017 at 10:17 AM, D?enan Zuki? wrote: > Hi Cyril, > > Francois has recently used compileif construct. That might help you. But I > can't find an instance of it right now. > > Also, we are moving to discourse . Please > post follow-ups there. > > Regards, > D?enan > > On Wed, Nov 22, 2017 at 9:54 AM, Cyril Mory fr> wrote: > >> Thanks for this answer. >> >> I am trying the approach you suggested, and would like to write a dot >> product functor that would work either on scalars (in which case it would >> perform a simple product) or on itk::VariableLengthVector of scalars (in >> which case it would perform a dot product). >> >> I found the "itk::NumericTraits::GetLength()" method, which >> works in both cases, and so I tried this: >> >> >> namespace Functor >> { >> template< class TPixel, class TInternal> >> class DotProduct >> { >> public: >> DotProduct() {} >> ~DotProduct() {} >> bool operator!=(const DotProduct &) const >> { >> return false; >> } >> >> bool operator==(const DotProduct & other) const >> { >> return !( *this != other ); >> } >> >> inline TInternal operator()(const TPixel & A, const TPixel & B) const >> { >> TInternal out = 0; >> for (unsigned int component=0; component < >> itk::NumericTraits::GetLength(); component++) >> { >> out += A[component] * B[component]; >> } >> return out; >> } >> }; >> } // end namespace functor >> >> >> But it does not compile with itk::Image inputs, since the pixels A and B >> have no [ ] operator. Is there a standard way around this problem ? >> >> Regards, >> Cyril >> >> >> On 22/11/2017 14:38, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: >> >>> Hello, >>> >>> There are an incredible number of different per-pixel operations that >>> could be implemented as ITK filters. We cannot provide them all. Many of >>> the basic operations are implemented as ITK filters these include >>> performing the basic C++ operators, such as +, -, * and /, on a per-pixel >>> basis. >>> >>> As you indicate there are many possible meanings for multiplication of >>> vector images, which can lead to confusion. >>> >>> ITK has a flexible set of Unary[1], Binary[2] functor filters. Classes >>> like the MultiplyImageFilter[3], are implemented by deriving from the base >>> functor classes. However it is easier to just use the base functor filter >>> and set the proper or custom functor, as in this example [4]. >>> >>> It is fairly easy to write a functor for your specific purposes by >>> following the existing set [5]. It is common for filters to internally >>> define a private functor to perform one step in a large filter. Moving from >>> writing for loops on pixels to writing custom functors is part of good >>> usage of ITK. >>> >>> >>> Brad >>> >>> >>> [1] https://itk.org/Doxygen/html/classitk_1_1UnaryFunctorImageFi >>> lter.html >>> [2] https://itk.org/Doxygen/html/classitk_1_1BinaryFunctorImageF >>> ilter.html >>> [3] https://itk.org/Doxygen/html/classitk_1_1MultiplyImageFilter.html >>> [4] https://itk.org/Doxygen/html/WikiExamples_2ImageProcessing_2 >>> BinaryFunctorImageFilter_8cxx-example.html#_a1 >>> >>> On 11/22/17, 5:15 AM, "Cyril Mory" >>> wrote: >>> >>> Dear ITK users, >>> I am using itk::VectorImage in some of my code, which uses >>> itk::VariableLengthVector as pixel type. And I am wondering why >>> itk::VariableLengthVector has so little support for multiplication. >>> Currently, the * operator only supports multiplication by a scalar. >>> It probably isn't simple, but I would need three additional >>> kinds of >>> multiplication: >>> - dot product with another VariableLengthVector (that has the >>> same >>> length, although it is probably a waste of time to perform the check >>> every time), returning a scalar >>> - component-wise multiplication, returning a >>> VariableLengthVector of the >>> same length >>> - left or right multiplication with a matrix (possibly an >>> itk::VariableSizeMatrix) that has the correct size, but I understand >>> that this is probably the most complex one, and since it only occurs >>> rarely in my code, I can handle it with conversions to vnl::vector >>> and >>> vnl::matrix >>> Are there constraints that prevent at least the dot product and >>> component-wise multiplication operators from being implemented ? If >>> not, >>> then I'd be happy to give it a try. Since both differ only by the >>> return >>> type, two different operators would have to be used (I guess). Do >>> you >>> have suggestions (which one should use *, and what should be the >>> other >>> operator) ? In itk::Vector and itk::CovariantVector, the * operator >>> is >>> used for dot product. >>> Regards, >>> Cyril >>> The ITK community is transitioning from this mailing list >>> to discourse.itk.org. Please join us there! >>> ________________________________ >>> Powered by www.kitware.com >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> Kitware offers ITK Training Courses, for more information >>> visit: >>> http://www.kitware.com/products/protraining.php >>> Please keep messages on-topic and check the ITK FAQ at: >>> http://www.itk.org/Wiki/ITK_FAQ >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/insight-users >>> >>> >>> >> The ITK community is transitioning from this mailing list to >> discourse.itk.org. Please join us there! >> ________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Kitware offers ITK Training Courses, for more information visit: >> http://www.kitware.com/products/protraining.php >> >> Please keep messages on-topic and check the ITK FAQ at: >> http://www.itk.org/Wiki/ITK_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/insight-users >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From grothausmann.roman at mh-hannover.de Fri Nov 24 06:26:38 2017 From: grothausmann.roman at mh-hannover.de (Grothausmann, Roman Dr.) Date: Fri, 24 Nov 2017 12:26:38 +0100 Subject: [ITK] [ITK-users] watershed on surface meshs Message-ID: <67d53e88-3783-6a6b-faae-cab064883d9d@mh-hannover.de> Dear mailing list members, I need to separate a mesh at "curved corners" (see attached PNG, using the colored labels from a facet analysis do not suffice but go in the right direction). So my current thought is to run vtkCurvature to get a Gaussian curvature value per point/vertex and then try to separate regions of positive values around local maxima. Just thresholding the result of vtkCurvature does not fully separate each local max from neighboring ones, but to my understanding a surface watershed would. I found two publications by Mangan and Whitaker on this: Partitioning 3D surface meshes using watershed: http://teacher.en.rmutt.ac.th/ktw/Resources/Full%20paper%20PDF/Partitioning%203D%20surface%20meshes%20using%20watershed%20segmentation.pdf Surface Segmentation Using Morphological Watersheds: https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8&ved=0ahUKEwjD0by1lafWAhVUGsAKHZ2MAbUQFgg_MAM&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.464.2788%26rep%3Drep1%26type%3Dpdf&usg=AFQjCNGX-p9-ElQFcpsUyBRO0pCjBKCmNg Does anybody know about an implementation for this in VTK/ITK or another open-source library? If not, would it be possible to transfer the ITK watershed implementation for voxel data to mesh data, e.g. to crate a VTKmorphWatershedFilter? Thanks for any help or hints. Roman -- Dr. Roman Grothausmann Tomographie und Digitale Bildverarbeitung Tomography and Digital Image Analysis Medizinische Hochschule Hannover Institut f?r Funktionelle und Angewandte Anatomie OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland Tel. +49 511 532-2900 grothausmann.roman at mh-hannover.de http://www.mh-hannover.de/anatomie.html -------------- next part -------------- A non-text attachment was scrubbed... Name: alv278.png Type: image/png Size: 174260 bytes Desc: not available URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From cyril.mory at creatis.insa-lyon.fr Fri Nov 24 06:54:25 2017 From: cyril.mory at creatis.insa-lyon.fr (Cyril Mory) Date: Fri, 24 Nov 2017 12:54:25 +0100 Subject: [ITK] [ITK-users] VariableLengthVector and multiplication In-Reply-To: References: <4740afa6-0730-728f-5a66-46cea25229ee@creatis.insa-lyon.fr> <26BF12F6-67F6-4488-81AC-14DDA1581CC3@mail.nih.gov> <23954cc4-a874-7213-471e-b817cab250aa@creatis.insa-lyon.fr> Message-ID: Thanks. Here is the solution I used, which works but may be sub-optimal: namespace Functor { ? template< class TPixel, class TInternal> ? class DotProduct ? { ? public: ??? DotProduct() {} ??? ~DotProduct() {} ??? bool operator!=(const DotProduct &) const ??? { ????? return false; ??? } ??? bool operator==(const DotProduct & other) const ??? { ????? return !( *this != other ); ??? } ? template ? inline ? typename itk::mpl::EnableIf, TInternal>::Type ? operator()(const TInternal & A, const TInternal & B) const ? { return static_cast( A * B ); } ? template ? typename itk::mpl::DisableIf, TInternal>::Type ? operator()(const TPixel & A, const TPixel & B) const ??? { ??? TInternal out = 0; ??? for (unsigned int component=0; component < itk::NumericTraits::GetLength(A); component++) ????? { ????? out += A[component] * B[component]; ????? } ??? return out; ??? } ? }; } // end namespace functor On 22/11/2017 18:42, D?enan Zuki? wrote: > I found it. Construct is called *EnableIf*, and you can see how it is > used in /ITK\Modules\Core\Common\test\itkEnableIfTest.cxx/ > > Regards > > On Wed, Nov 22, 2017 at 10:17 AM, D?enan Zuki? > wrote: > > Hi Cyril, > > Francois has recently used compileif construct. That might help > you. But I can't find an instance of it right now. > > Also, we are moving to discourse . > Please post follow-ups there. > > Regards, > D?enan > > On Wed, Nov 22, 2017 at 9:54 AM, Cyril Mory > > wrote: > > Thanks for this answer. > > I am trying the approach you suggested, and would like to > write a dot product functor that would work either on scalars > (in which case it would perform a simple product) or on > itk::VariableLengthVector of scalars (in which case it would > perform a dot product). > > I found the "itk::NumericTraits::GetLength()" method, > which works in both cases, and so I tried this: > > > namespace Functor > { > ? template< class TPixel, class TInternal> > ? class DotProduct > ? { > ? public: > ??? DotProduct() {} > ??? ~DotProduct() {} > ??? bool operator!=(const DotProduct &) const > ??? { > ????? return false; > ??? } > > ??? bool operator==(const DotProduct & other) const > ??? { > ????? return !( *this != other ); > ??? } > > ??? inline TInternal operator()(const TPixel & A, const TPixel > & B) const > ??? { > ??? TInternal out = 0; > ??? for (unsigned int component=0; component < > itk::NumericTraits::GetLength(); component++) > ????? { > ????? out += A[component] * B[component]; > ????? } > ??? return out; > ??? } > ? }; > } // end namespace functor > > > But it does not compile with itk::Image inputs, since the > pixels A and B have no [ ] operator. Is there a standard way > around this problem ? > > Regards, > Cyril > > > On 22/11/2017 14:38, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: > > Hello, > > There are an incredible number of different per-pixel > operations that could be implemented as ITK filters. We > cannot provide them all. Many of the basic operations are > implemented as ITK filters these include performing the > basic C++ operators, such as +, -, * and /, on a per-pixel > basis. > > As you indicate there are many possible meanings for > multiplication of vector images, which can lead to confusion. > > ITK has a flexible set of Unary[1], Binary[2] functor > filters. Classes like the MultiplyImageFilter[3], are > implemented by deriving from the base functor classes. > However it is easier to just use the base functor filter > and set the proper or custom functor, as in this example [4]. > > It is fairly easy to write a functor for your specific > purposes by following the existing set [5]. It is common > for filters to internally define a private functor to > perform one step in a large filter. Moving from writing > for loops on pixels to writing custom functors is part of > good usage of ITK. > > > Brad > > > [1] > https://itk.org/Doxygen/html/classitk_1_1UnaryFunctorImageFilter.html > > [2] > https://itk.org/Doxygen/html/classitk_1_1BinaryFunctorImageFilter.html > > [3] > https://itk.org/Doxygen/html/classitk_1_1MultiplyImageFilter.html > > [4] > https://itk.org/Doxygen/html/WikiExamples_2ImageProcessing_2BinaryFunctorImageFilter_8cxx-example.html#_a1 > > > On 11/22/17, 5:15 AM, "Cyril Mory" > > wrote: > > ? ? ?Dear ITK users, > ? ? ? ? ? I am using itk::VectorImage in some of my code, > which uses > ? ? ?itk::VariableLengthVector as pixel type. And I am > wondering why > ? ? ?itk::VariableLengthVector has so little support for > multiplication. > ? ? ?Currently, the * operator only supports > multiplication by a scalar. > ? ? ? ? ? It probably isn't simple, but I would need three > additional kinds of > ? ? ?multiplication: > ? ? ? ? ? - dot product with another VariableLengthVector > (that has the same > ? ? ?length, although it is probably a waste of time to > perform the check > ? ? ?every time), returning a scalar > ? ? ? ? ? - component-wise multiplication, returning a > VariableLengthVector of the > ? ? ?same length > ? ? ? ? ? - left or right multiplication with a matrix > (possibly an > ? ? ?itk::VariableSizeMatrix) that has the correct size, > but I understand > ? ? ?that this is probably the most complex one, and since > it only occurs > ? ? ?rarely in my code, I can handle it with conversions > to vnl::vector and > ? ? ?vnl::matrix > ? ? ? ? ? Are there constraints that prevent at least the > dot product and > ? ? ?component-wise multiplication operators from being > implemented ? If not, > ? ? ?then I'd be happy to give it a try. Since both differ > only by the return > ? ? ?type, two different operators would have to be used > (I guess). Do you > ? ? ?have suggestions (which one should use *, and what > should be the other > ? ? ?operator) ? In itk::Vector and itk::CovariantVector, > the * operator is > ? ? ?used for dot product. > ? ? ? ? ? Regards, > ? ? ? ? ? Cyril > ? ? ? ? ? ? ? ?The ITK community is transitioning from > this mailing list to discourse.itk.org > . Please join us there! > ? ? ?________________________________ > ? ? ?Powered by www.kitware.com > ? ? ? ? ? Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > ? ? ? ? ? Kitware offers ITK Training Courses, for more > information visit: > http://www.kitware.com/products/protraining.php > > ? ? ? ? ? Please keep messages on-topic and check the ITK > FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > ? ? ? ? ? Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > > > > > The ITK community is transitioning from this mailing list to > discourse.itk.org . Please join us > there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Fri Nov 24 08:46:05 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 24 Nov 2017 08:46:05 -0500 Subject: [ITK] [ITK-users] VariableLengthVector and multiplication In-Reply-To: References: <4740afa6-0730-728f-5a66-46cea25229ee@creatis.insa-lyon.fr> <26BF12F6-67F6-4488-81AC-14DDA1581CC3@mail.nih.gov> <23954cc4-a874-7213-471e-b817cab250aa@creatis.insa-lyon.fr> Message-ID: That looks about right. Thanks for sharing your solution. Regards, D?enan On Fri, Nov 24, 2017 at 6:54 AM, Cyril Mory wrote: > Thanks. > > Here is the solution I used, which works but may be sub-optimal: > > namespace Functor > { > template< class TPixel, class TInternal> > class DotProduct > { > public: > DotProduct() {} > ~DotProduct() {} > bool operator!=(const DotProduct &) const > { > return false; > } > > bool operator==(const DotProduct & other) const > { > return !( *this != other ); > } > > template > inline > typename itk::mpl::EnableIf, > TInternal>::Type > operator()(const TInternal & A, const TInternal & B) const > { return static_cast( A * B ); } > > template > typename itk::mpl::DisableIf, > TInternal>::Type > operator()(const TPixel & A, const TPixel & B) const > { > TInternal out = 0; > for (unsigned int component=0; component < itk::NumericTraits::GetLength(A); > component++) > { > out += A[component] * B[component]; > } > return out; > } > }; > } // end namespace functor > > > On 22/11/2017 18:42, D?enan Zuki? wrote: > > I found it. Construct is called *EnableIf*, and you can see how it is > used in *ITK\Modules\Core\Common\test\itkEnableIfTest.cxx* > > Regards > > On Wed, Nov 22, 2017 at 10:17 AM, D?enan Zuki? wrote: > >> Hi Cyril, >> >> Francois has recently used compileif construct. That might help you. But >> I can't find an instance of it right now. >> >> Also, we are moving to discourse . Please >> post follow-ups there. >> >> Regards, >> D?enan >> >> On Wed, Nov 22, 2017 at 9:54 AM, Cyril Mory < >> cyril.mory at creatis.insa-lyon.fr> wrote: >> >>> Thanks for this answer. >>> >>> I am trying the approach you suggested, and would like to write a dot >>> product functor that would work either on scalars (in which case it would >>> perform a simple product) or on itk::VariableLengthVector of scalars (in >>> which case it would perform a dot product). >>> >>> I found the "itk::NumericTraits::GetLength()" method, which >>> works in both cases, and so I tried this: >>> >>> >>> namespace Functor >>> { >>> template< class TPixel, class TInternal> >>> class DotProduct >>> { >>> public: >>> DotProduct() {} >>> ~DotProduct() {} >>> bool operator!=(const DotProduct &) const >>> { >>> return false; >>> } >>> >>> bool operator==(const DotProduct & other) const >>> { >>> return !( *this != other ); >>> } >>> >>> inline TInternal operator()(const TPixel & A, const TPixel & B) const >>> { >>> TInternal out = 0; >>> for (unsigned int component=0; component < >>> itk::NumericTraits::GetLength(); component++) >>> { >>> out += A[component] * B[component]; >>> } >>> return out; >>> } >>> }; >>> } // end namespace functor >>> >>> >>> But it does not compile with itk::Image inputs, since the pixels A and B >>> have no [ ] operator. Is there a standard way around this problem ? >>> >>> Regards, >>> Cyril >>> >>> >>> On 22/11/2017 14:38, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote: >>> >>>> Hello, >>>> >>>> There are an incredible number of different per-pixel operations that >>>> could be implemented as ITK filters. We cannot provide them all. Many of >>>> the basic operations are implemented as ITK filters these include >>>> performing the basic C++ operators, such as +, -, * and /, on a per-pixel >>>> basis. >>>> >>>> As you indicate there are many possible meanings for multiplication of >>>> vector images, which can lead to confusion. >>>> >>>> ITK has a flexible set of Unary[1], Binary[2] functor filters. Classes >>>> like the MultiplyImageFilter[3], are implemented by deriving from the base >>>> functor classes. However it is easier to just use the base functor filter >>>> and set the proper or custom functor, as in this example [4]. >>>> >>>> It is fairly easy to write a functor for your specific purposes by >>>> following the existing set [5]. It is common for filters to internally >>>> define a private functor to perform one step in a large filter. Moving from >>>> writing for loops on pixels to writing custom functors is part of good >>>> usage of ITK. >>>> >>>> >>>> Brad >>>> >>>> >>>> [1] https://itk.org/Doxygen/html/classitk_1_1UnaryFunctorImageFi >>>> lter.html >>>> [2] https://itk.org/Doxygen/html/classitk_1_1BinaryFunctorImageF >>>> ilter.html >>>> [3] https://itk.org/Doxygen/html/classitk_1_1MultiplyImageFilter.html >>>> [4] https://itk.org/Doxygen/html/WikiExamples_2ImageProcessing_2 >>>> BinaryFunctorImageFilter_8cxx-example.html#_a1 >>>> >>>> On 11/22/17, 5:15 AM, "Cyril Mory" >>>> wrote: >>>> >>>> Dear ITK users, >>>> I am using itk::VectorImage in some of my code, which uses >>>> itk::VariableLengthVector as pixel type. And I am wondering why >>>> itk::VariableLengthVector has so little support for multiplication. >>>> Currently, the * operator only supports multiplication by a scalar. >>>> It probably isn't simple, but I would need three additional >>>> kinds of >>>> multiplication: >>>> - dot product with another VariableLengthVector (that has the >>>> same >>>> length, although it is probably a waste of time to perform the >>>> check >>>> every time), returning a scalar >>>> - component-wise multiplication, returning a >>>> VariableLengthVector of the >>>> same length >>>> - left or right multiplication with a matrix (possibly an >>>> itk::VariableSizeMatrix) that has the correct size, but I >>>> understand >>>> that this is probably the most complex one, and since it only >>>> occurs >>>> rarely in my code, I can handle it with conversions to vnl::vector >>>> and >>>> vnl::matrix >>>> Are there constraints that prevent at least the dot product >>>> and >>>> component-wise multiplication operators from being implemented ? >>>> If not, >>>> then I'd be happy to give it a try. Since both differ only by the >>>> return >>>> type, two different operators would have to be used (I guess). Do >>>> you >>>> have suggestions (which one should use *, and what should be the >>>> other >>>> operator) ? In itk::Vector and itk::CovariantVector, the * >>>> operator is >>>> used for dot product. >>>> Regards, >>>> Cyril >>>> The ITK community is transitioning from this mailing >>>> list to discourse.itk.org. Please join us there! >>>> ________________________________ >>>> Powered by www.kitware.com >>>> Visit other Kitware open-source projects at >>>> http://www.kitware.com/opensource/opensource.html >>>> Kitware offers ITK Training Courses, for more information >>>> visit: >>>> http://www.kitware.com/products/protraining.php >>>> Please keep messages on-topic and check the ITK FAQ at: >>>> http://www.itk.org/Wiki/ITK_FAQ >>>> Follow this link to subscribe/unsubscribe: >>>> http://public.kitware.com/mailman/listinfo/insight-users >>>> >>>> >>>> >>> The ITK community is transitioning from this mailing list to >>> discourse.itk.org. Please join us there! >>> ________________________________ >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Kitware offers ITK Training Courses, for more information visit: >>> http://www.kitware.com/products/protraining.php >>> >>> Please keep messages on-topic and check the ITK FAQ at: >>> http://www.itk.org/Wiki/ITK_FAQ >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/insight-users >>> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Fri Nov 24 10:53:41 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Fri, 24 Nov 2017 10:53:41 -0500 Subject: [ITK] [ITK-users] watershed on surface meshs In-Reply-To: <67d53e88-3783-6a6b-faae-cab064883d9d@mh-hannover.de> References: <67d53e88-3783-6a6b-faae-cab064883d9d@mh-hannover.de> Message-ID: Hi Roman, I don't know of any implementation of mesh watershed segmentation. ITK does not really have mesh processing capabilities, it is mostly limited to conversion between mesh and image representations. A colleague worked on something related, maybe he can provide the source code if you ask. And we are moving to discourse . Re-posting this question there might be useful. Regards, D?enan On Fri, Nov 24, 2017 at 6:26 AM, Grothausmann, Roman Dr. < grothausmann.roman at mh-hannover.de> wrote: > Dear mailing list members, > > > I need to separate a mesh at "curved corners" (see attached PNG, using the > colored labels from a facet analysis do not suffice but go in the right > direction). So my current thought is to run vtkCurvature to get a Gaussian > curvature value per point/vertex and then try to separate regions of > positive values around local maxima. Just thresholding the result of > vtkCurvature does not fully separate each local max from neighboring ones, > but to my understanding a surface watershed would. I found two publications > by Mangan and Whitaker on this: > > Partitioning 3D surface meshes using watershed: > http://teacher.en.rmutt.ac.th/ktw/Resources/Full%20paper%20P > DF/Partitioning%203D%20surface%20meshes%20using%20watershed% > 20segmentation.pdf > > Surface Segmentation Using Morphological Watersheds: > https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd > =4&cad=rja&uact=8&ved=0ahUKEwjD0by1lafWAhVUGsAKHZ2MAbUQFgg_M > AM&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownlo > ad%3Fdoi%3D10.1.1.464.2788%26rep%3Drep1%26type%3Dpdf&usg= > AFQjCNGX-p9-ElQFcpsUyBRO0pCjBKCmNg > > Does anybody know about an implementation for this in VTK/ITK or another > open-source library? If not, would it be possible to transfer the ITK > watershed implementation for voxel data to mesh data, e.g. to crate a > VTKmorphWatershedFilter? > > Thanks for any help or hints. > Roman > > > -- > Dr. Roman Grothausmann > > Tomographie und Digitale Bildverarbeitung > Tomography and Digital Image Analysis > > Medizinische Hochschule Hannover > Institut f?r Funktionelle und Angewandte Anatomie > OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland > > Tel. +49 511 532-2900 > grothausmann.roman at mh-hannover.de > http://www.mh-hannover.de/anatomie.html > > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From richard.beare at gmail.com Fri Nov 24 15:53:49 2017 From: richard.beare at gmail.com (Richard Beare) Date: Sat, 25 Nov 2017 07:53:49 +1100 Subject: [ITK] [ITK-users] watershed on surface meshs In-Reply-To: <67d53e88-3783-6a6b-faae-cab064883d9d@mh-hannover.de> References: <67d53e88-3783-6a6b-faae-cab064883d9d@mh-hannover.de> Message-ID: I don't recall an implementation of this anywhere. However you may be able to hack something together reasonably quickly. Watersheds are built around minimal paths, so depending on what complexity is available in the mesh-based shortest path tools. In the worst cast you could create a copy of the mesh for each seed region, compute the minimal distance to each non seed vertex, then do a vertex-wise min, tracking which mesh/seed region has the minimum, and that's your label. Not very efficient because you compute the entire mesh distance each time, and no obvious way to do a watershed line consistently, but perhaps that doesn't matter for testing the idea. On Fri, Nov 24, 2017 at 10:26 PM, Grothausmann, Roman Dr. < grothausmann.roman at mh-hannover.de> wrote: > Dear mailing list members, > > > I need to separate a mesh at "curved corners" (see attached PNG, using the > colored labels from a facet analysis do not suffice but go in the right > direction). So my current thought is to run vtkCurvature to get a Gaussian > curvature value per point/vertex and then try to separate regions of > positive values around local maxima. Just thresholding the result of > vtkCurvature does not fully separate each local max from neighboring ones, > but to my understanding a surface watershed would. I found two publications > by Mangan and Whitaker on this: > > Partitioning 3D surface meshes using watershed: > http://teacher.en.rmutt.ac.th/ktw/Resources/Full%20paper%20P > DF/Partitioning%203D%20surface%20meshes%20using%20watershed% > 20segmentation.pdf > > Surface Segmentation Using Morphological Watersheds: > https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd > =4&cad=rja&uact=8&ved=0ahUKEwjD0by1lafWAhVUGsAKHZ2MAbUQFgg_ > MAM&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc% > 2Fdownload%3Fdoi%3D10.1.1.464.2788%26rep%3Drep1%26type% > 3Dpdf&usg=AFQjCNGX-p9-ElQFcpsUyBRO0pCjBKCmNg > > Does anybody know about an implementation for this in VTK/ITK or another > open-source library? If not, would it be possible to transfer the ITK > watershed implementation for voxel data to mesh data, e.g. to crate a > VTKmorphWatershedFilter? > > Thanks for any help or hints. > Roman > > > -- > Dr. Roman Grothausmann > > Tomographie und Digitale Bildverarbeitung > Tomography and Digital Image Analysis > > Medizinische Hochschule Hannover > Institut f?r Funktionelle und Angewandte Anatomie > OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland > > Tel. +49 511 532-2900 > grothausmann.roman at mh-hannover.de > http://www.mh-hannover.de/anatomie.html > > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From richard.beare at gmail.com Fri Nov 24 22:16:42 2017 From: richard.beare at gmail.com (Richard Beare) Date: Sat, 25 Nov 2017 14:16:42 +1100 Subject: [ITK] [ITK-users] watershed on surface meshs In-Reply-To: <67d53e88-3783-6a6b-faae-cab064883d9d@mh-hannover.de> References: <67d53e88-3783-6a6b-faae-cab064883d9d@mh-hannover.de> Message-ID: Just remembered something that may be useful for testing. I wrote the following for doing watersheds on geospatial graphs using R/igraph. Certainly isn't efficient, but may be useful for testing if you can turn your mesh+curvature into something like a text file. This was set up for allocating points on maps to destinations based on travel time. It performed a kind of smoothing to smooth non-sensical travel time estimates, but the basic algorithm is there. It will take some fiddling. You could probably do something equivalent with python, probably doing better than this priorty queue, but using much the same approach with igraph. library(liqueueR) ## Mostly a copy of PriorityQueue from liqueueR StablePriorityQueue <- setRefClass("StablePriorityQueue", contains = "Queue", fields = list( count = "numeric", entries = "numeric", priorities = "numeric", prioritise = "function" ), methods = list( sort_ = function() { order = order(priorities, entries, decreasing = TRUE, partial = size():1) # data <<- data[order] priorities <<- priorities[order] entries <<- entries[order] }, push = function(item, priority = NULL) { 'Inserts element into the queue, reordering according to priority.' callSuper(item) # if (is.null(priority)) priority = prioritise(item) # priorities <<- c(priorities, priority) entries <<- c(entries, count) count <<- count - 1 # sort_() }, pop = function(N = 1) { # 'Removes and returns head of queue (or raises error if queue is empty).' if (N > size()) stop("insufficient items in queue!") priorities <<- priorities[-seq_len(N)] entries <<- entries[-seq_len(N)] callSuper(N) }, initialize = function(prioritise = NULL, ...) { 'Creates a PriorityQueue object.' callSuper(...) # ## to enforce FIFO order count <<- 0 if (is.null(prioritise)) .self$prioritise = function(x) 0 else .self$prioritise = prioritise # .self } ) ) igraph.watershed <- function(Gr, labelfield, unlabelled, vertexid, alltimes) { Gres <- Gr ## Watershed, without marking boundary (Beucher) ## 1. find all marker nodes that have a background neighbour lablist <- which(vertex_attr(Gr, labelfield) != unlabelled) nlist <- ego(Gr, 1, lablist) uu <- which(map_lgl(nlist, ~any(vertex_attr(Gr, labelfield, .x)==unlabelled))) ## uu indexes the labelled vertexes ## need indexes into all vertexes uu <- lablist[uu] ## create priority queue qq <- StablePriorityQueue$new() ## Insert the boundary markers kk <- lapply(uu, qq$push, priority=0) all.labels <- get.vertex.attribute(Gr, labelfield) all.ids <- get.vertex.attribute(Gr, vertexid) alltimes <- subset(alltimes, from %in% all.ids, select=c("from", "Hospital", "minutes")) dd <- duplicated(alltimes[, c("from", "Hospital")]) alltimes <- alltimes[!dd,] alltimes.wide <- spread_(alltimes, key="Hospital", value="minutes") ## Make the order the same as all.ids - so now we'll be able to index by number rownames(alltimes.wide) <- alltimes.wide$from alltimes.wide <- alltimes.wide[all.ids, ] cc <- 1:ncol(alltimes.wide) names(cc) <- colnames(alltimes.wide) while (qq$size() > 0) { vid <- qq$pop() ## Get the neighbours nb <- neighborhood(Gr, 1, vid, mode="all", mindist=1)[[1]] nlabs <- all.labels[nb] ## Are any neighbours unknown? ul <- nlabs==unlabelled if (any(ul)) { this.label <- all.labels[vid] nbb <- nb[ul] all.labels[nbb] <- this.label this.label.idx <- cc[this.label] priorities <- alltimes.wide[[this.label.idx]][nbb] kk <- map2(nbb, priorities, ~qq$push(.x, priority = .y* -1)) } } return(data.frame(PlaceID=all.ids, Hospital=all.labels, stringsAsFactors = FALSE)) } On Fri, Nov 24, 2017 at 10:26 PM, Grothausmann, Roman Dr. < grothausmann.roman at mh-hannover.de> wrote: > Dear mailing list members, > > > I need to separate a mesh at "curved corners" (see attached PNG, using the > colored labels from a facet analysis do not suffice but go in the right > direction). So my current thought is to run vtkCurvature to get a Gaussian > curvature value per point/vertex and then try to separate regions of > positive values around local maxima. Just thresholding the result of > vtkCurvature does not fully separate each local max from neighboring ones, > but to my understanding a surface watershed would. I found two publications > by Mangan and Whitaker on this: > > Partitioning 3D surface meshes using watershed: > http://teacher.en.rmutt.ac.th/ktw/Resources/Full%20paper%20P > DF/Partitioning%203D%20surface%20meshes%20using%20watershed% > 20segmentation.pdf > > Surface Segmentation Using Morphological Watersheds: > https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd > =4&cad=rja&uact=8&ved=0ahUKEwjD0by1lafWAhVUGsAKHZ2MAbUQFgg_ > MAM&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc% > 2Fdownload%3Fdoi%3D10.1.1.464.2788%26rep%3Drep1%26type% > 3Dpdf&usg=AFQjCNGX-p9-ElQFcpsUyBRO0pCjBKCmNg > > Does anybody know about an implementation for this in VTK/ITK or another > open-source library? If not, would it be possible to transfer the ITK > watershed implementation for voxel data to mesh data, e.g. to crate a > VTKmorphWatershedFilter? > > Thanks for any help or hints. > Roman > > > -- > Dr. Roman Grothausmann > > Tomographie und Digitale Bildverarbeitung > Tomography and Digital Image Analysis > > Medizinische Hochschule Hannover > Institut f?r Funktionelle und Angewandte Anatomie > OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland > > Tel. +49 511 532-2900 > grothausmann.roman at mh-hannover.de > http://www.mh-hannover.de/anatomie.html > > The ITK community is transitioning from this mailing list to > discourse.itk.org. Please join us there! > ________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Kitware offers ITK Training Courses, for more information visit: > http://www.kitware.com/products/protraining.php > > Please keep messages on-topic and check the ITK FAQ at: > http://www.itk.org/Wiki/ITK_FAQ > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/insight-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From bakkari.abdelkhalek at hotmail.fr Sat Nov 25 06:49:11 2017 From: bakkari.abdelkhalek at hotmail.fr (Abdelkhalek Bakkari) Date: Sat, 25 Nov 2017 11:49:11 +0000 Subject: [ITK] [ITK-users] U-Net: Convolutional Networks for image segmentation Message-ID: Dear ITK users, I want to know if there is any ITK filter or an example related to U-Net Convolutional Networks. Thank you in advance. Kind regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From erin at computerhead.com.au Sat Nov 25 19:34:04 2017 From: erin at computerhead.com.au (Erin McKay) Date: Sun, 26 Nov 2017 11:34:04 +1100 Subject: [ITK] [ITK-users] Insight-users Digest, Vol 163, Issue 10 In-Reply-To: References: Message-ID: <59024AB2-7D63-4301-9B1F-D54922F7E23A@computerhead.com.au> Not without an adapter, but my Mac Pro might be able to Erin McKay > On 26 Nov 2017, at 04:00, insight-users-request at itk.org wrote: > > Send Insight-users mailing list submissions to > insight-users at itk.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://public.kitware.com/mailman/listinfo/insight-users > or, via email, send a message with subject or body 'help' to > insight-users-request at itk.org > > You can reach the person managing the list at > insight-users-owner at itk.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Insight-users digest..." > > > Today's Topics: > > 1. Re: watershed on surface meshs (Richard Beare) > 2. Re: watershed on surface meshs (Richard Beare) > 3. U-Net: Convolutional Networks for image segmentation > (Abdelkhalek Bakkari) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 25 Nov 2017 07:53:49 +1100 > From: Richard Beare > To: "Grothausmann, Roman Dr." > Cc: ITK Mailing List , VTK Mailing List > > Subject: Re: [ITK-users] watershed on surface meshs > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > I don't recall an implementation of this anywhere. However you may be able > to hack something together reasonably quickly. Watersheds are built around > minimal paths, so depending on what complexity is available in the > mesh-based shortest path tools. In the worst cast you could create a copy > of the mesh for each seed region, compute the minimal distance to each non > seed vertex, then do a vertex-wise min, tracking which mesh/seed region has > the minimum, and that's your label. Not very efficient because you compute > the entire mesh distance each time, and no obvious way to do a watershed > line consistently, but perhaps that doesn't matter for testing the idea. > > On Fri, Nov 24, 2017 at 10:26 PM, Grothausmann, Roman Dr. < > grothausmann.roman at mh-hannover.de> wrote: > >> Dear mailing list members, >> >> >> I need to separate a mesh at "curved corners" (see attached PNG, using the >> colored labels from a facet analysis do not suffice but go in the right >> direction). So my current thought is to run vtkCurvature to get a Gaussian >> curvature value per point/vertex and then try to separate regions of >> positive values around local maxima. Just thresholding the result of >> vtkCurvature does not fully separate each local max from neighboring ones, >> but to my understanding a surface watershed would. I found two publications >> by Mangan and Whitaker on this: >> >> Partitioning 3D surface meshes using watershed: >> http://teacher.en.rmutt.ac.th/ktw/Resources/Full%20paper%20P >> DF/Partitioning%203D%20surface%20meshes%20using%20watershed% >> 20segmentation.pdf >> >> Surface Segmentation Using Morphological Watersheds: >> https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd >> =4&cad=rja&uact=8&ved=0ahUKEwjD0by1lafWAhVUGsAKHZ2MAbUQFgg_ >> MAM&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc% >> 2Fdownload%3Fdoi%3D10.1.1.464.2788%26rep%3Drep1%26type% >> 3Dpdf&usg=AFQjCNGX-p9-ElQFcpsUyBRO0pCjBKCmNg >> >> Does anybody know about an implementation for this in VTK/ITK or another >> open-source library? If not, would it be possible to transfer the ITK >> watershed implementation for voxel data to mesh data, e.g. to crate a >> VTKmorphWatershedFilter? >> >> Thanks for any help or hints. >> Roman >> >> >> -- >> Dr. Roman Grothausmann >> >> Tomographie und Digitale Bildverarbeitung >> Tomography and Digital Image Analysis >> >> Medizinische Hochschule Hannover >> Institut f?r Funktionelle und Angewandte Anatomie >> OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland >> >> Tel. +49 511 532-2900 >> grothausmann.roman at mh-hannover.de >> http://www.mh-hannover.de/anatomie.html >> >> The ITK community is transitioning from this mailing list to >> discourse.itk.org. Please join us there! >> ________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Kitware offers ITK Training Courses, for more information visit: >> http://www.kitware.com/products/protraining.php >> >> Please keep messages on-topic and check the ITK FAQ at: >> http://www.itk.org/Wiki/ITK_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/insight-users >> >> > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > Message: 2 > Date: Sat, 25 Nov 2017 14:16:42 +1100 > From: Richard Beare > To: "Grothausmann, Roman Dr." > Cc: ITK Mailing List > Subject: Re: [ITK-users] watershed on surface meshs > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > Just remembered something that may be useful for testing. I wrote the > following for doing watersheds on geospatial graphs using R/igraph. > Certainly isn't efficient, but may be useful for testing if you can turn > your mesh+curvature into something like a text file. > > This was set up for allocating points on maps to destinations based on > travel time. It performed a kind of smoothing to smooth non-sensical travel > time estimates, but the basic algorithm is there. It will take some > fiddling. You could probably do something equivalent with python, probably > doing better than this priorty queue, but using much the same approach with > igraph. > > library(liqueueR) > > ## Mostly a copy of PriorityQueue from liqueueR > StablePriorityQueue <- setRefClass("StablePriorityQueue", > contains = "Queue", > fields = list( > count = "numeric", > entries = "numeric", > priorities = "numeric", > prioritise = "function" > ), > methods = list( > sort_ = function() { > order = order(priorities, entries, > decreasing = TRUE, partial = size():1) > # > data <<- data[order] > priorities <<- priorities[order] > entries <<- entries[order] > }, > push = function(item, priority = NULL) > { > 'Inserts element into the queue, > reordering according to priority.' > callSuper(item) > # > if (is.null(priority)) priority = > prioritise(item) > # > priorities <<- c(priorities, > priority) > entries <<- c(entries, count) > count <<- count - 1 > # > sort_() > }, > pop = function(N = 1) { > # 'Removes and returns head of queue > (or raises error if queue is empty).' > if (N > size()) stop("insufficient > items in queue!") > priorities <<- > priorities[-seq_len(N)] > entries <<- entries[-seq_len(N)] > callSuper(N) > }, > initialize = function(prioritise = > NULL, ...) { > 'Creates a PriorityQueue object.' > callSuper(...) > # > ## to enforce FIFO order > count <<- 0 > if (is.null(prioritise)) > .self$prioritise = function(x) 0 > else > .self$prioritise = prioritise > # > .self > } > ) > ) > > > > igraph.watershed <- function(Gr, labelfield, unlabelled, vertexid, alltimes) > { > Gres <- Gr > ## Watershed, without marking boundary (Beucher) > ## 1. find all marker nodes that have a background neighbour > lablist <- which(vertex_attr(Gr, labelfield) != unlabelled) > nlist <- ego(Gr, 1, lablist) > uu <- which(map_lgl(nlist, ~any(vertex_attr(Gr, labelfield, > .x)==unlabelled))) > ## uu indexes the labelled vertexes > ## need indexes into all vertexes > uu <- lablist[uu] > ## create priority queue > qq <- StablePriorityQueue$new() > ## Insert the boundary markers > kk <- lapply(uu, qq$push, priority=0) > all.labels <- get.vertex.attribute(Gr, labelfield) > all.ids <- get.vertex.attribute(Gr, vertexid) > alltimes <- subset(alltimes, from %in% all.ids, select=c("from", > "Hospital", "minutes")) > dd <- duplicated(alltimes[, c("from", "Hospital")]) > alltimes <- alltimes[!dd,] > alltimes.wide <- spread_(alltimes, key="Hospital", value="minutes") > ## Make the order the same as all.ids - so now we'll be able to index by > number > rownames(alltimes.wide) <- alltimes.wide$from > alltimes.wide <- alltimes.wide[all.ids, ] > cc <- 1:ncol(alltimes.wide) > names(cc) <- colnames(alltimes.wide) > while (qq$size() > 0) { > vid <- qq$pop() > ## Get the neighbours > nb <- neighborhood(Gr, 1, vid, mode="all", mindist=1)[[1]] > nlabs <- all.labels[nb] > ## Are any neighbours unknown? > ul <- nlabs==unlabelled > if (any(ul)) { > this.label <- all.labels[vid] > nbb <- nb[ul] > all.labels[nbb] <- this.label > this.label.idx <- cc[this.label] > priorities <- alltimes.wide[[this.label.idx]][nbb] > kk <- map2(nbb, priorities, ~qq$push(.x, priority = .y* -1)) > } > } > return(data.frame(PlaceID=all.ids, Hospital=all.labels, stringsAsFactors > = FALSE)) > } > > > > > On Fri, Nov 24, 2017 at 10:26 PM, Grothausmann, Roman Dr. < > grothausmann.roman at mh-hannover.de> wrote: > >> Dear mailing list members, >> >> >> I need to separate a mesh at "curved corners" (see attached PNG, using the >> colored labels from a facet analysis do not suffice but go in the right >> direction). So my current thought is to run vtkCurvature to get a Gaussian >> curvature value per point/vertex and then try to separate regions of >> positive values around local maxima. Just thresholding the result of >> vtkCurvature does not fully separate each local max from neighboring ones, >> but to my understanding a surface watershed would. I found two publications >> by Mangan and Whitaker on this: >> >> Partitioning 3D surface meshes using watershed: >> http://teacher.en.rmutt.ac.th/ktw/Resources/Full%20paper%20P >> DF/Partitioning%203D%20surface%20meshes%20using%20watershed% >> 20segmentation.pdf >> >> Surface Segmentation Using Morphological Watersheds: >> https://www.google.de/url?sa=t&rct=j&q=&esrc=s&source=web&cd >> =4&cad=rja&uact=8&ved=0ahUKEwjD0by1lafWAhVUGsAKHZ2MAbUQFgg_ >> MAM&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc% >> 2Fdownload%3Fdoi%3D10.1.1.464.2788%26rep%3Drep1%26type% >> 3Dpdf&usg=AFQjCNGX-p9-ElQFcpsUyBRO0pCjBKCmNg >> >> Does anybody know about an implementation for this in VTK/ITK or another >> open-source library? If not, would it be possible to transfer the ITK >> watershed implementation for voxel data to mesh data, e.g. to crate a >> VTKmorphWatershedFilter? >> >> Thanks for any help or hints. >> Roman >> >> >> -- >> Dr. Roman Grothausmann >> >> Tomographie und Digitale Bildverarbeitung >> Tomography and Digital Image Analysis >> >> Medizinische Hochschule Hannover >> Institut f?r Funktionelle und Angewandte Anatomie >> OE 4120, Carl-Neuberg-Str. 1, 30625 Hannover, Deutschland >> >> Tel. +49 511 532-2900 >> grothausmann.roman at mh-hannover.de >> http://www.mh-hannover.de/anatomie.html >> >> The ITK community is transitioning from this mailing list to >> discourse.itk.org. Please join us there! >> ________________________________ >> Powered by www.kitware.com >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Kitware offers ITK Training Courses, for more information visit: >> http://www.kitware.com/products/protraining.php >> >> Please keep messages on-topic and check the ITK FAQ at: >> http://www.itk.org/Wiki/ITK_FAQ >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/insight-users >> >> > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > Message: 3 > Date: Sat, 25 Nov 2017 11:49:11 +0000 > From: Abdelkhalek Bakkari > To: ITK Users , "dzenanz at gmail.com" > > Subject: [ITK-users] U-Net: Convolutional Networks for image > segmentation > Message-ID: > > > Content-Type: text/plain; charset="iso-8859-1" > > Dear ITK users, > > I want to know if there is any ITK filter or an example related to U-Net Convolutional Networks. > > Thank you in advance. > > Kind regards, > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > > ------------------------------ > > Subject: Digest Footer > > The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! > ____________________________________ > Insight-users mailing list > Insight-users at itk.org > http://public.kitware.com/mailman/listinfo/insight-users > > > ------------------------------ > > End of Insight-users Digest, Vol 163, Issue 10 > ********************************************** The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From dzenanz at gmail.com Sun Nov 26 10:26:37 2017 From: dzenanz at gmail.com (=?UTF-8?B?RMW+ZW5hbiBadWtpxIc=?=) Date: Sun, 26 Nov 2017 10:26:37 -0500 Subject: [ITK] [ITK-users] U-Net: Convolutional Networks for image segmentation In-Reply-To: References: Message-ID: Hi Abdelkhalek, ITK has this group of classes for neural networks. But I don't think it has a convolutional NN. Regards, D?enan On Sat, Nov 25, 2017 at 6:49 AM, Abdelkhalek Bakkari < bakkari.abdelkhalek at hotmail.fr> wrote: > Dear ITK users, > > I want to know if there is any ITK filter or an example related > to U-Net Convolutional Networks. > > Thank you in advance. > > Kind regards, > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- The ITK community is transitioning from this mailing list to discourse.itk.org. Please join us there! ________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://www.kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/insight-users From k3ops at free.fr Mon Nov 27 08:13:01 2017 From: k3ops at free.fr (k3ops at free.fr) Date: Mon, 27 Nov 2017 14:13:01 +0100 (CET) Subject: [ITK] Levenberg Marquart optimization with bounds Message-ID: <733652150.58739343.1511788381887.JavaMail.root@zimbra31-e6> Hello all, I would like to know if somebody has already used the Levenberg Marquart optimizer with parameter bounds? I am trying to fit 6 values using the Levenberg Marquart optimizer with 3 parameters, it's working very well but it sometimes gets incorrect results (non optimal results) because I knwow that one of my parameter has a restricted range of value (e.g between 0 to 200). I looked for examples or other optimizer in ITK for adding this kind of restrictions but I found nothing. I found this interesting website that explain what I need: https://lmfit.github.io/lmfit-py/bounds.html Thank you in advance, Florent From poyu_kao at ucsb.edu Tue Nov 28 21:40:39 2017 From: poyu_kao at ucsb.edu (Po-Yu Kao) Date: Tue, 28 Nov 2017 18:40:39 -0800 Subject: [ITK] How to using SimpleITK to access and change the voxel value without touch the metadata Message-ID: Hello, I am using SimpleITK library in python 2.7. I want to do some basic preprocessing on CT scans with nii.gz. format. For example, I use img = sitk.ReadImage(ct_scan_path) to read the image, and then use nda = sitk.GetArrayFromImage(ct_img) to access n-dimensional numpy array. Then, I do some preprocessing steps on this n-dimensional numpy, and save it back to the image format by using img_preprocessed = sitk.GetImageFromArray(nda_preprocessed). However, when I check the metadata of these two images, it gives me different values which are showed below. Does anyone know how to copy all the metadata from the original image to another image? or Does anyone know how to access and change the voxel value of the image without touching the metadata? Original Image: print img Image (0x4237b40) RTTI typeinfo: itk::Image Reference Count: 1 Modified Time: 3601 Debug: Off Object Name: Observers: none Source: (none) Source output name: (none) Release Data: Off Data Released: False Global Release Data: Off PipelineMTime: 3578 UpdateMTime: 3600 RealTimeStamp: 0 seconds LargestPossibleRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] BufferedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] RequestedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] Spacing: [0.488281, 0.488281, 5] Origin: [-114, 294.012, 21.82] Direction: 1 0 0 0 -1 0 0 0 1 IndexToPointMatrix: 0.488281 0 0 0 -0.488281 0 0 0 5 PointToIndexMatrix: 2.048 0 0 0 -2.048 0 0 0 0.2 Inverse Direction: 1 0 0 0 -1 0 0 0 1 PixelContainer: ImportImageContainer (0x398e780) RTTI typeinfo: itk::ImportImageContainer Reference Count: 1 Modified Time: 3597 Debug: Off Object Name: Observers: none Pointer: 0x7f6ef9225010 Container manages memory: true Size: 9699328 Capacity: 9699328 Preprocessed Image: Image (0x3857e60) RTTI typeinfo: itk::Image Reference Count: 1 Modified Time: 3605 Debug: Off Object Name: Observers: none Source: (none) Source output name: (none) Release Data: Off Data Released: False Global Release Data: Off PipelineMTime: 0 UpdateMTime: 0 RealTimeStamp: 0 seconds LargestPossibleRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] BufferedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] RequestedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] Spacing: [1, 1, 1] Origin: [0, 0, 0] Direction: 1 0 0 0 1 0 0 0 1 IndexToPointMatrix: 1 0 0 0 1 0 0 0 1 PointToIndexMatrix: 1 0 0 0 1 0 0 0 1 Inverse Direction: 1 0 0 0 1 0 0 0 1 PixelContainer: ImportImageContainer (0x39856c0) RTTI typeinfo: itk::ImportImageContainer Reference Count: 1 Modified Time: 3606 Debug: Off Object Name: Observers: none Pointer: 0x7f6ef4823010 Container manages memory: true Size: 9699328 Capacity: 9699328 -------------- next part -------------- An HTML attachment was scrubbed... URL: From zivrafael.yaniv at nih.gov Wed Nov 29 10:13:22 2017 From: zivrafael.yaniv at nih.gov (Yaniv, Ziv Rafael (NIH/NLM/LHC) [C]) Date: Wed, 29 Nov 2017 15:13:22 +0000 Subject: [ITK] How to using SimpleITK to access and change the voxel value without touch the metadata In-Reply-To: References: Message-ID: Hello Po-Yu Kao, The step you are missing is that you need to explicitly copy the meta-data information from your original image, the function is CopyInformation(). This assumes that you did not change any spatial information (padded the numpy array as part of your processing which implies a change in the spatial region occupied by the image etc.). Your code should look something like this: ct_img = sitk.ReadImage(ct_scan_path) nda = sitk.GetArrayFromImage(ct_img) # Do some work on the numpy array nda img_preprocessed = sitk.GetImageFromArray(nda_preprocessed) img_preprocessed.CopyInformation(ct_img) If you did change some spatial aspects of the image in your numpy code then you will need to set them manually: img_preprocessed.SetSpacing(new_spacing) img_preprocessed.SetOrigin(new_origin) img_preprocessed.SetDirection(new_direction) We are moving away from the mailing to a discourse forum: https://discourse.itk.org/ Please post future questions on that forum. regards Ziv From: Po-Yu Kao Date: Tuesday, November 28, 2017 at 9:41 PM To: "community at itk.org" Subject: [ITK] How to using SimpleITK to access and change the voxel value without touch the metadata Hello, I am using SimpleITK library in python 2.7. I want to do some basic preprocessing on CT scans with nii.gz. format. For example, I use img = sitk.ReadImage(ct_scan_path) to read the image, and then use nda = sitk.GetArrayFromImage(ct_img) to access n-dimensional numpy array. Then, I do some preprocessing steps on this n-dimensional numpy, and save it back to the image format by using img_preprocessed = sitk.GetImageFromArray(nda_preprocessed). However, when I check the metadata of these two images, it gives me different values which are showed below. Does anyone know how to copy all the metadata from the original image to another image? or Does anyone know how to access and change the voxel value of the image without touching the metadata? Original Image: print img Image (0x4237b40) RTTI typeinfo: itk::Image Reference Count: 1 Modified Time: 3601 Debug: Off Object Name: Observers: none Source: (none) Source output name: (none) Release Data: Off Data Released: False Global Release Data: Off PipelineMTime: 3578 UpdateMTime: 3600 RealTimeStamp: 0 seconds LargestPossibleRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] BufferedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] RequestedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] Spacing: [0.488281, 0.488281, 5] Origin: [-114, 294.012, 21.82] Direction: 1 0 0 0 -1 0 0 0 1 IndexToPointMatrix: 0.488281 0 0 0 -0.488281 0 0 0 5 PointToIndexMatrix: 2.048 0 0 0 -2.048 0 0 0 0.2 Inverse Direction: 1 0 0 0 -1 0 0 0 1 PixelContainer: ImportImageContainer (0x398e780) RTTI typeinfo: itk::ImportImageContainer Reference Count: 1 Modified Time: 3597 Debug: Off Object Name: Observers: none Pointer: 0x7f6ef9225010 Container manages memory: true Size: 9699328 Capacity: 9699328 Preprocessed Image: Image (0x3857e60) RTTI typeinfo: itk::Image Reference Count: 1 Modified Time: 3605 Debug: Off Object Name: Observers: none Source: (none) Source output name: (none) Release Data: Off Data Released: False Global Release Data: Off PipelineMTime: 0 UpdateMTime: 0 RealTimeStamp: 0 seconds LargestPossibleRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] BufferedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] RequestedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 37] Spacing: [1, 1, 1] Origin: [0, 0, 0] Direction: 1 0 0 0 1 0 0 0 1 IndexToPointMatrix: 1 0 0 0 1 0 0 0 1 PointToIndexMatrix: 1 0 0 0 1 0 0 0 1 Inverse Direction: 1 0 0 0 1 0 0 0 1 PixelContainer: ImportImageContainer (0x39856c0) RTTI typeinfo: itk::ImportImageContainer Reference Count: 1 Modified Time: 3606 Debug: Off Object Name: Observers: none Pointer: 0x7f6ef4823010 Container manages memory: true Size: 9699328 Capacity: 9699328 -------------- next part -------------- An HTML attachment was scrubbed... URL: