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-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/ 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-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: 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-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/ 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-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: From nasil122002 at yahoo.de Thu Nov 9 14:59:10 2017 From: nasil122002 at yahoo.de (Yusuf OEZBEK) Date: Thu, 9 Nov 2017 19:59:10 +0000 (UTC) Subject: [ITK-users] itk::fem updating displacements References: <587898442.10039537.1510257550772.ref@mail.yahoo.com> Message-ID: <587898442.10039537.1510257550772@mail.yahoo.com> Dear ITK users,I have another question. In order to visualize the deformation, I want to replace the old node coordinates with the new one after generating the solution, like in UpdateDisplacements() function in itkFemSolver.hxx 610-651 The code-block, which generates solution:m_FemSolver->Update(); //m_FemSolver->UpdateDisplacements(); const unsigned int invalidId= itk::fem::Element::InvalidDegreeOfFreedomID; int numberOfNodes= m_FemSolver->GetInput()->GetNumberOfNodes(); for(int i= 0; i< numberOfNodes; i++) { itk::fem::Element::Node::Pointer node= m_FemSolver->GetInput()->GetNode(i); std::cout<<"FEM Mesh Node: "<< node->GetGlobalNumber() << " Coordinates: "<< node->GetCoordinates()<GetDegreeOfFreedom(j))!= invalidId; j++) { cout <<"FEM Mesh Solution: "<< m_FemSolver->GetSolution(dof)<GetInput()->GetNode(i); //itk::fem::Element::Node::Pointer node= m_Fem3dSolver->GetInput()->GetNode(i); for(unsigned int j= 0; j< 3; j++) { std::cout<<"FEM Mesh Solution Vector: "<GetSolution(node->GetDegreeOfFreedom(j))<GetCoordinates()[j] + m_FemSolver->GetSolution(node->GetDegreeOfFreedom(j)); //replacedNodeVector[j] = node->GetCoordinates()[j] + m_ls->GetSolutionValue(node->GetDegreeOfFreedom(j)); } node->SetCoordinates(replacedNodeVector); std::cout<<"FEM Mesh New Node: "<< node->GetGlobalNumber() << " Coordinates: "<< node->GetCoordinates()<GetCoordinates()[j] + m_FemSolver->GetSolution(node->GetDegreeOfFreedom(j)); In my test application, I apply some force at node 1( loadNode->SetNode(1); ) but in generated solution it shows that the force doesn?t act on node 1 and nodes around it but for nodes 68, 69, 82, and 83. All the other solutions are zero. My test mesh contains 86 nodes and 162 elements. If I want to apply the force except node 1,eg at node 20, I get then segmentation fault.typedef itk::fem::LoadNode LoadNodeType; LoadNodeType::Pointer loadNode= LoadNodeType::New(); loadNode->SetElement(tetrahedronElement.GetPointer()); loadNode->SetGlobalNumber(3); loadNode->SetNode(1); vnl_vector force(3); force[0]= 110.0; force[1]= 20.0; force[2]= 31.0; loadNode->SetForce(force); m_FemObject->AddNextLoad(loadNode); For detailed information please see runnable test code:vtkUGridToFemMesh.zip | | | | | | | | | | | vtkUGridToFemMesh.zip Shared with Dropbox | | | | Thank you for any help! -------------- 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-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/ 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-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: 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-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: 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-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: 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-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 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-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 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-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 > > > 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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: 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-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 > ********************************************** 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-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: From poyu_kao at ece.ucsb.edu Tue Nov 28 21:32:54 2017 From: poyu_kao at ece.ucsb.edu (Po-Yu Kao) Date: Tue, 28 Nov 2017 18:32:54 -0800 Subject: [ITK-users] How to using SimpleITK to 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 poyu_kao at ece.ucsb.edu Tue Nov 28 21:35:18 2017 From: poyu_kao at ece.ucsb.edu (Po-Yu Kao) Date: Tue, 28 Nov 2017 18:35:18 -0800 Subject: [ITK-users] 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: